https://aihints.com/how-to-draw-bounding-box-in-opencv-python/ How to Draw Bounding Box in OpenCV Python - AiHints You can draw a bounding box in OpenCV Python by following the given steps. Import the OpenCV library. Now read the image from the location. aihints.com 이미지 내 특정 그림을 포함하는 bbox만을 남겨두고, 나머지는 crop해버리는 코드 def make_inner_crop(): # target_lst is list of cropped image, # we're going to remo..
사소한 Tip . 오류 해결법
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
vscode의 extension 활용. "file-tree-generator" 설치 후, 원하는 최상단 폴더에서 우클릭, "Generate to Tree" 선택 생성된 파일로 icon on/off 선택해서 활용. 도움주신 출처 : https://jane-aeiou.tistory.com/80
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..
학습 과정에서 터미널에 뜨는 결과물을 따로 log파일로 저장해야 할 때가 있다. 간혹 터미널창을 재로딩하면, 기존의 내용이 날라가버려서 이 프로그램이 무슨 원인으로 꺼졌는지 확인할 수 없는 경우를 대비하기 위함이다. 보통 Logger라는 클래스로 python training 코드에 삽입하는 경우가 있는데, 간단하게 아래 명령어를 입력해서도, 진행할 수 있다. 이럴 때 다음 tee 명령어를 입력할 경우, 터미널 창에 내용을 띄우고 동시에 파일에 로깅할 수도 있다. python train.py 2>&1 | tee -a out1.log 이때 2>&1이라는 옵션이 있어야 터미널 창, log파일 모두 동일한 내용이 들어가게 된다. (1은 stdout, 2는 stderr 의미) 도움 주신 사이트 [Python] 콘..
Pytorch tensor 내 특정 값과 해당되는 index가 필요할 경우 아래 코드로 확인할 수 있다. x = torch.Tensor([11, 22, 33, 22]) print((x==22).nonzero(as_tuple=True)[0]) 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() direct..
https://jamoya.one/ 자모야 모여라 한글 자모가 분리되어 표시되는 파일 이름을 수정하는 온라인 도구입니다. 애플 기기에서 설정한 파일명이 윈도우에서 깨져 표시될 때 유용합니다. jamoya.one 상단 링크를 들어가면 변경하여 다운로드 가능 서버와의 통신 X, 파일 이름만 Unicode 정규화하여 다운로드하는 형태. 자세한 코드 Github : https://github.com/hyunbinseo/mac-filename-kr GitHub - hyunbinseo/mac-filename-kr: 자소가 분리된 한글 파일명을 고치는 도구 자소가 분리된 한글 파일명을 고치는 도구. Contribute to hyunbinseo/mac-filename-kr development by creating a..
https://80000coding.oopy.io/d5d36b7d-b605-4d1f-b2d9-ad0ddd8f1ff9 VSCode 파일 확장자로 정렬하기 개요 80000coding.oopy.io
Anaonda 가상환경을 복제하여 테스트 할때는 아래의 명령어를 사용하면 된다. conda create --name [$NEW_NAME] --clone [$TARGET_NAME] ex) 가상환경 A를 B라는 이름으로 clone하고 싶을 때 conda create --name B --clone A
프로세스 내 내가 어떤 커맨드로 해당 프로세스를 실행했는지 확인할 때는 주로 nvidia-smi나 ps-f 로 찾는다. 이때, 단순히 ps -f -o cmd PID만으로는 terminal창의 한계로 인해 CMD 전체 문장이 나오지 않는 경우가 존재한다. 이때 다음 커맨드를 사용해서 여러 줄에 걸쳐서 전체 문장이 나오게끔 하자. cat /proc/{$PID}/cmdline 중간에 원하는 프로세스의 PID를 넣어주면 cmd을 여러 줄에 걸쳐서 전체 다 확인할 수 있다.
기본적으로 tuple 내 합은 concat을 의미한다. 만약 길이가 동일한 tuple끼리 더하여, 요소 합을 만들고 싶으면 아래 처럼 진행하면 된다. sum = tuple(sum(elem) for elem in zip(tA, tB)) 도움 주신 사이트 : 출처 [tuple] 튜플 요소끼리 더하기, 튜플요소에 상수 곱하기 파이썬에는 array와 유사해 보이는 tuple 이라는 개념이 있다. () 를 사용하여 둘러싸면 tuple이 되는데 사... blog.naver.com
reads the file list.txt in which the file names are listed and deletes the rest leaving only the files that exist in it import os import glob from tqdm import tqdm import pdb # Read the list of filenames from list.txt for step in ["train","val", "test"]: print("=="+step+"==") with open(step+".txt", 'r') as f: filenames = f.read().splitlines() filenames = [f_n.split("/")[-1].rstrip("\n") for f_n ..