전체 글

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()해주지 않아서 ..
Js.Y
Y초보프로그래머