tph-yolov5를 돌리는 중, 다음과 같은 에러 발생 File "/opt/conda/envs/tph-yolov5/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, **kwargs) File "/opt/conda/envs/tph-yolov5/lib/python3.7/site-packages/torch/nn/modules/upsampling.py", line 157, in forward recompute_scale_factor=self.recompute_scale_factor) File "/opt/conda/envs/tph-yolov5/lib/python3.7..
분류 전체보기
단순 기록용 포스팅입니다. 원 출처는 아래를 참고 부탁드립니다. pip install googletrans==4.0.0-rc1 def korean_to_eng(text): translator = Translator() name2eng = translator.translate(text, dest='en').text return name2eng - 도움 주신 출처 : https://coding-kindergarten.tistory.com/98 [Python/Googletrans] 파이썬으로 구글 번역 API 사용하는 법 안녕하세요, 왕초보 코린이를 위한 코딩유치원에 오신 것을 환영합니다. 오늘은 영어를 해석할 때 자주 도움받는 구글 번역(Google Translate)을 파이썬에서 사용하는 방법에 대해 알아..
1. ctrl + shift + P를 눌러 검색. 2. "Preferences: Open Setting (UI)" 검색 후, 선택. 3. 상단 검색창에서 "window.openFilesInNewWindow" 선택 4. "on"으로 셋팅 5. 동일한 검색창에서 "workbench.editor.enablePreview" 검색 후, 체크 해제. : 이 옵션은 미리보기 옵션을 해제하여, 한번만 눌러도 무조건 새탭에서 보이게끔 하기 위한 옵션임. 만약 이 옵션을 설정하면, 무조건 더블클릭했을 때 새 탭에 파일이 뜨고 한번 클릭할 때는 기존처럼 탭이 전환되어서 표시된다. [도움 주신 출처] https://shakeratos.tistory.com/99
(tensor == target_value).nonzero(as_tuple=True) https://stackoverflow.com/questions/47863001/how-pytorch-tensor-get-the-index-of-specific-value How Pytorch Tensor get the index of specific value With python lists, we can do: a = [1, 2, 3] assert a.index(2) == 1 How can a pytorch tensor find the .index() directly? stackoverflow.com
1. Dataloader shuffle=False일 때, dataset = torchvision.datasets.ImageFolder(, transforms=) dataloader = torch.utils.data.DataLoader(dataset, batch_size=, shuffle=False) # 이미 기존 DataLoader에서 shuffle을 사용하지 않을 경우, "dataloader.dataset.samples"안에 # (파일경로, 라벨) 튜플로 이루어진 list형태로 저장되어 있다. allFiles, _ = map(list, zip(*dataloader.dataset.samples)) for i, (inputs, labels) in enumerate(dataloader): inputs = i..
def strike(draw, img, font, text): # Get the image, and calculate the average of font thickness. twidth, theight = img.size lx, ly = twidth, theight/2 thickness = 2 if twidth >200 or theight > 200 else 1 draw.line((0, ly, lx, ly), fill="black", width=thickness) # [0, height/2] ~ [width, height/2] # "*"처럼 위로 올려붙는 특수 문자의 경우, font의 getmask함수로 영역을 잡아줘야 함. def special_strike(draw, img, font, text): t..
https://stackoverflow.com/questions/43060479/how-to-get-the-font-pixel-height-using-pils-imagefont-class How to get the font pixel height using PIL's ImageFont class? I am using PIL' ImageFont module to load fonts to generate text images. I want the text to tightly bound to the edge, however, when using the ImageFont to get the font height, It seems that it incl... stackoverflow.com Font Loading..
vscode의 extension 활용. "file-tree-generator" 설치 후, 원하는 최상단 폴더에서 우클릭, "Generate to Tree" 선택 생성된 파일로 icon on/off 선택해서 활용. 도움주신 출처 : https://jane-aeiou.tistory.com/80
64의 배수로 input size를 조정해주면 된다. 내가 많이 쓰는 input size는 640 .... , 1024, 1600... 등이 있다. https://github.com/CompVis/stable-diffusion/issues/301
matplotlib plt.subplots warning 삭제 for문과 matplotlib를 사용해서 이미지를 그릴 때, 다음과 같은 warning이 나오는 경우가 있다. RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). 이럴때는 내가 열어준 fig를 close()해주지 않아서 ..
https://matplotlib.org/stable/gallery/shapes_and_collections/hatch_style_reference.html Hatch style reference — Matplotlib 3.7.1 documentation Note Click here to download the full example code Hatch style reference Hatches can be added to most polygons in Matplotlib, including bar, fill_between, contourf, and children of Polygon. They are currently supported in the PS, PDF, SVG, OSX, and Agg bac..
이미 예전부터 많은 사람들이 쓰고 있는 LR 스케줄러로, 통상적으로 이런 포맷을 만들 수 있다는 점에서 큰 장점을 가진다. Pytorch에 공식으로 구현된 CosineAnnealingWarmRestart는 Warmup start가 구현되어 있지 않고 lr 최댓값이 감소하는 방안에 대해서 구현되어 있지 않다고 한다. 아래 블로그 링크를 참고하면 친절하신 어느 개발자께서 구현해주신 Custom Cosine AnnealingWarmupRestart를 많이 사용하곤 하는데, 나는 이상하게 저분 코드만 사용하면 기대하는 모습의 lr_scheduler가 나오지 않는다. 더보기 (optimzer의 초기 lr을 0로 두고 진행하는데도, 이상하게 아래 이미지 초록색 라인처럼 자꾸 lr이 위로 올라감.) https://g..
https://github.com/open-mmlab/mmdetection/issues/2739#issuecomment-631196300 Loss becomes NAN after a few iterations · Issue #2739 · open-mmlab/mmdetection I am training a bespoke dataset using the default Mask RCNN parameterisation (see parameters below). I have converted my bespoke dataset to COCO format, with the annotations in JSON files (polygons... github.com TO DO LIST check if the datase..
https://github.com/python-pillow/Pillow/issues/1380 PNG write is failing due to IOError · Issue #1380 · python-pillow/Pillow Folks, I believe I have found an file (JPG) that is causing PIL to report a false IO Error, and write a zero byte file. Now the following code is working fine for other JPG, PNG, etc files: (Please... github.com from PIL import Image image_file = Image.open("./error_img.pn..
import torch from tqdm.notebook import tqdm import glob from PIL import Image from torchvision.transforms import ToTensor target_path = "./images/*" img_lst = glob.glob(target_path) totensor = ToTensor() img_val_lst = [] for img in tqdm(img_lst): img_RGB = Image.open(img).convert("RGB") img_val = totensor(img_RGB) img_val_lst.append(img_val) mean = torch.zeros(3) std = torch.zeros(3) print('==> ..