전체 글

https://stackoverflow.com/questions/75409654/python-valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-am Python, ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() My question is related to the answer to my previous question. the difference between the code in the previous solutions and the current code on this question is a..
https://stackoverflow.com/questions/41171191/tqdm-progressbar-and-zip-built-in-do-not-work-together tqdm progressbar and zip built-in do not work together tqdm is a Python module to easily print in the console a dynamically updating progressbar. For example from tqdm import tqdm from time import sleep for _ in tqdm(range(10)): sleep(0.1) pri... stackoverflow.com zip이나 enumerate는 length가 보이지 않기때문..
opencv-python 외에 추가로 contrib도 설치해야 함. pip install opencv-contrib-python
docker 내 container에서 특정 모델을 돌리다 터미널 안에선 오류가 나서 중단되는데, 간혹 그 프로세스가 Nan과 같은 쓰레기 프로세스로 남아있는 경우가 있다. 이럴 경우 container로 접속하지 않고 메인 사용자 계정으로 nvidia-smi를 켜서 PID를 확인하게 되는데, 간혹 nvidia-smi로 봐도 PID가 뜨지 않고, htop이나 nvtop으로만 PID가 보이는 경우가 존재한다. 근데 이렇게 어렵게 발견한 PID로 process kill을 시도할 경우, "No such process"라고 뜨면서 해당 process를 종료할 수 없는 경우가 존재하는데, 이는 docker container 안에서의 PID와 실 server 내 PID가 다르면서 생기는 이슈이다. bash: kill:..
단순히 내 용도로 다른 블로그에 있던 tmux 명령어 정리 세션 관련 명령어tmux ls : 현재 동작하는 세션 listup# 새로운 세션 생성 (with window 지정)$ tmux new -s $SESSION_NAME (-n $ WINDOW_NAME)# 세션 명 변경 Modify Session Namectrl + b, $# 세션 종료 Terminate se..
from urllib.parse import unquote # 디코딩할때 from urllib.parse import quote # 인코딩할때 text = '%ED%85%8C%EC%8A%A4%ED%8A%B8%EB%AC%B8%EC%9E%A5' print(unquote(text)) >>> "테스트문장" str = "테스트문장" print(quote(str)) >>> '%ED%85%8C%EC%8A%A4%ED%8A%B8%EB%AC%B8%EC%9E%A5' 도움주신 출처 : 링크 [웹크롤링] 한글 URL 인코딩/디코딩 (URL Encoding/Decoding) 🔍 예상 검색어 더보기 # 한글 URL 인코딩 # 한글을 URL 인코딩하기 # URL 인코딩 문자열 한글로 변환하기 # 한국어 URL 인코딩 변환하는 법 #..
통상적으로 glob이나 os.listdir로 파일 리스트를 정리하고, 이를 sorting해주면 아래와 같이 정렬된다. 파일명을 문자열로 인식하기 때문에 아래처럼 정렬되는데, 이를 natsort라는 python package로 정렬해주면 우리가 원하는 파일 정렬이 가능하다. 3. natsort API — natsort 8.2.0 documentation out – The sequence ordered by index, as a list or as an iterator (depending on the value of iter). natsort.readthedocs.io # 기존 방식 sorted(file_list) """ file_1.jpg file_10.jpg file_11.jpg file_12.jpg f..
[ WARN:0@14.442] global loadsave.cpp:244 findDecoder imread_('./이미지/img.jpg'): can't open/read file: check file path/integrity 해결법 : numpy로 기존 string을 변경해준다. img_array = np.fromfile(full_path, np.uint8) img = cv2.imdecode(img_array, cv2.IMREAD_COLOR) 도움 주신 출처 : https://velog.io/@hyesukim1/%EC%98%A4%EB%A5%98cant-openread-file-check-file-pathintegrity-cv2.Imread-%EB%AA%BB%EC%9D%BD%EC%96%B4%EC%98%A..
파일들이 있는 폴더로 들어가서 아래 명령어 실행. for file in *; do mv "$file" `echo $file | tr ' ' '_'`; done 그럼 기존 띄어쓰기가 있던 파일이 일괄적으로 _로 변경됨 ex) "샘플 이미지.jpg" >> "샘플_이미지.jpg" https://www.linuxadictos.com/ko/reemplazar-espacios-por-guiones-bajos.html 파일 이름의 공백을 밑줄로 바꾸는 방법 공백이있는 이름으로 콘솔이나 터미널에서 작업 할 때 문제가있는 사람 중 하나입니다. 왜냐하면 이것을 읽으면 그만두 게 될 것이기 때문입니다. www.linuxadictos.com - 파일명에 번호 붙이기 ls -v | cat -n | while read n f; ..
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..
Js.Y
Y초보프로그래머