분류 전체보기

학습 과정에서 터미널에 뜨는 결과물을 따로 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
https://pypi.org/project/polygon-pascalvoc-writer/ polygon-pascalvoc-writer For generating Pascal VOC XML image annotation files pypi.org 응용 코드 import glob from tqdm import tqdm import os import json import xmltodict import cv2 import codecs import numpy as np from shutil import copyfile from polygon_pascalvoc_writer import VocWriter CLASS_label = ['CLASS_A', 'CLASS_B', ...] #https://blog.actors..
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을 여러 줄에 걸쳐서 전체 다 확인할 수 있다.
https://github.com/fcakyon/labelme2coco GitHub - fcakyon/labelme2coco: A lightweight package for converting your labelme annotations into COCO object detection format. A lightweight package for converting your labelme annotations into COCO object detection format. - GitHub - fcakyon/labelme2coco: A lightweight package for converting your labelme annotations into ... github.com json_load 함수나 save..
기본적으로 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 ..
아래 코드는 input 이미지가 jpg형식일 때 적용 가능한 코드 from PIL import Image, ImageDraw, ImageFont # Open the image file image = Image.open('./input_image.jpg') # Create a drawing context for the image draw = ImageDraw.Draw(image, "RGBA") # Define the polygon points polygon_points = [(50, 50), (200, 50), (200, 200), (50, 200)] #polygon_points = [50, 50, 200, 50, 200, 200, 50, 200] # Define the fill color and tran..
가끔 tif 이미지를 cv2로 로딩하는데 Nonetype인 경우가 있다. 경로를 잘못썼나 확인해보는데, 그것도 아니다. 분명 확장자 이름도 .tif / .TIF 형태이고, windows 내 파일 속성에서도 파일 형식이 TIF파일이라 명시되는데... 이럴땐 다른 이미지 뷰어를 확인해보자. 예로 꿀뷰라는 이미지 뷰어로 확인해보면 간혹 이미지 정보가 "GIF"라고 떠있는 경우가 있다. 원인은 모르지만 tif파일이 gif로 인코딩 된 것 같다. 결론적으로 파일 확장자를 바꿔 gif로 로딩해주면 이미지가 잘 로딩된다.
# x, y, w, h ROI img = cv2.imread('test.jpg') cropped_img = img[y: y + h, x: x + w] 참고자료 : https://eehoeskrap.tistory.com/419
Github : https://github.com/yellowjs0304/PascalVOC2Yolo 코드는 데이터 디렉토리 안에 배치 ┌── Data Directory ├── images : Image set Directory ├── train : XML set Directory(for Train) ├── val : XML set Directory(for Validation) ├── test : XML set Directory(for Test) ├── images_filelist.txt : List of Image Pathes ├── train_filelist.txt : List of Train XML pathes ├── val_filelist.txt : List of Validation XML path..
· 환경구축
previous torch 설치과정에서 아래와 같이 matching하는 package를 찾지 못한다는 에러가 등장하면, Python 버전을 확인해보자. Python 3.6버전에서는 아래와 같은 에러가 많이 등장하므로 최소 3.7 이상으로 conda 환경을 구축하자. ERROR: Could not find a version that satisfies the requirement torch==1.11.0+cu113 (from versions: 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.0+cu113, 1.1..
Js.Y
'분류 전체보기' 카테고리의 글 목록 (6 Page)