model 학습 시 loss대신 predict 결과가 나올 경우
Problem mask rcnn transfer learning중에 loss dict를 구하는 상황이었는데, model(image,target)넣어도 다음처럼 predict 결과만 숭숭 나왔다. {'boxes': tensor([[ 23.0990, 377.5876, 305.9265, 562.2125], [ 11.2159, 242.4047, 369.8665, 428.1471], [155.2247, 96.2208, 580.0000, 248.9312], [ 5.0806, 275.1395, 101.7696, 426.0195], [ 20.9149, 266.0938, 331.9341, 614.7516], [ 11.2956, 134.7541, 386.5382, 542.4605], [ 57.4241, 228.0799, ..
Dataloader dictionary에서 batch를 밖으로 빼내기
Problem 기존에 pytorch로 구현되어 있는 maskrcnn training 코드를 pytorch lightning으로 바꾸다가 발생한 문제. 모델의 loss를 계산하기위해 입력하는 데이터의 형식이 약간 다른 문제가 발생. batch가 dictionary 안에 들어가 있어서 이를 dictionary 밖으로 빼내야 한다. # 현재 상태 { 'boxes': tensor([[[ 25., 209., 343., 610.]], [[181., 138., 550., 608.]]], device='cuda:1') } # 되어야하는 상태 # batch가 dictionary 밖으로 나와야함 [ {'boxes': tensor([[ 25., 209., 343., 610.]], device='cuda:1')}, {'box..
change edge thickness (using opencv Morphological Transformations )
Problem cv2.canny를 이용해 추출한 edge의 thickness를 올리고 싶어서 방법을 찾던중 형태학적 변환(Morphological Transformations)을 opencv에서 이미 제공을 하고 있는 것을 발견했다. thickness를 늘릴수도있고, 줄일수도있고, 잡티를 제거할수도 있는등, 다양한 방법을 제공하고 있었다. 난 그중에 thickness를 늘리는 것이 목적이었으므로 해당 함수를 적용했다. Solution plt.subplot(1,3,1) plt.imshow(edges,cmap='gray') plt.subplot(1,3,2) kernel = np.ones((3,3),np.uint8) dilation = cv2.dilate(edges,kernel,iterations = 1) p..