전체 글
-
[MMDetection 에러] RuntimeError: Address already in useProgramming Error/PyTorch 2021. 12. 16. 20:24
RuntimeError: Address already in use Traceback (most recent call last): File "/root/miniconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/root/miniconda3/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/root/miniconda3/lib/python3.7/site-packages/torch/distributed/launch.py", line 235, in main() File "/root/miniconda3/lib/p..
-
[Pytorch 에러] RuntimeError: legacy constructor expects device type: cpu but device type: cuda was passed & Input type (torch.cuda.ByteTensor) and weight type (torch.cuda.FloatTensor) should be the sameProgramming Error/PyTorch 2021. 11. 22. 16:18
Pytorch를 Framework으로 사용할 때, 대부분 GPU를 사용하여 학습이나 추론을 수행하실 겁니다. 그러다보면 가끔 아래와 같은 오류를 만날 수 있는데요. RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same 여기서 Input type (torch.cuda.FloatTensor)는 입력(이미지, 텍스트 등)이 현재 GPU(cuda)에 올라가있는 상태이면서 Floating point가 Float32라는 것을 의미합니다. 반면에 weight type (torch.FloatTensor)은 사용하는 모델의 가중치 타입을 의미합니다. 따라서, 현재 모델은 .cuda가 안붙..
-
[OpenCV 오류] THRESH_OTSU mode: > 'src_type == CV_8UC1 || src_type == CV_16UC1'Programming Error/Python 2021. 9. 24. 22:36
import cv2 img = cv2.imread('./image1.png') _, thresh = cv2.threshold(img, 0, 255.0, cv2.THRESH_BINARY + cv2.THRESH_OTSU) 보통 이미지의 특정 포인트를 탐지하거나 Segmentation Task를 다루다보면 threshold를 기준으로 Binary 이미지로 바꾸어주는 threshold 함수를 자주 접할 수 있을 것입니다. 보통 Binary 이미지를 만들 때, 특정 threshold (임계값)를 사람이 지정해 주어야하는데, 오츠 이진화 방법은 threshold를 지정하지 않고 모든 경우의 수 중에서 적절한 바이너리한 두 부류의 명암 분포가 균일할 때를 선택해주는 방법으로 자주 사용됩니다 (방법에 대한 더 자세한 ..