Deep Learning

    wandb (Weights & Biases) 사용법 (logging, sweep을 통한 hyperparameter tuning, 모델 가중치 및 그래디언트 확인)

    wandb (Weights & Biases) 사용법 (logging, sweep을 통한 hyperparameter tuning, 모델 가중치 및 그래디언트 확인)

    이전에 yolo 관련 글을 엄청나게 썼었는데 yolo를 사용하면서 접하게 되었던 트래킹용 도구이다.모델 실험 시 metric들을 logging하거나 hyperparameter를 변경하며 반복 실험이 필요할 경우 유용하다. pytorch 기준으로 작성한다. 1. 설치 및 initializationpip install wandb 터미널에서 pip을 통해 간단하게 설치할 수 있다. wandb 계정을 생성한 후wandb login 커맨드를 입력한 다음 API 키를 입력하면 해당 계정과 연결이 된다. 2. 학습 코드에 wandb 추가 예시wandb run 생성import wandbwandb.init() wandb.init() 커맨드를 사용하면 데이터를 logging하기 위한 background process가 생..

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Test

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Test

    https://minmiin.tistory.com/15 [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Train 이전 글에서는 Yolo 모델을 위한 데이터셋을 만들었다. https://minmiin.tistory.com/14 [Yolo] Custom Dataset으로 Yolo 돌려보기 : 데이터셋 준비 이전에 Custom Dataset을 통해 yolo를 학습하는 글을 쓴 적이.. minmiin.tistory.com Train에 이어지는 글이다. 앞서 yaml 파일에 test 경로를 지정했다. yaml_data = {"names":['with_mask', 'without_mask', 'mask_weared_incorrect'], # 클래스 이름 "nc":3, # 클래스 수 "pat..

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Inference

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Inference

    https://minmiin.tistory.com/15 [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Train 이전 글에서는 Yolo 모델을 위한 데이터셋을 만들었다. https://minmiin.tistory.com/14 [Yolo] Custom Dataset으로 Yolo 돌려보기 : 데이터셋 준비 이전에 Custom Dataset을 통해 yolo를 학습하는 글을 쓴 적이.. minmiin.tistory.com 이전 글에 이어 Inference를 수행해 보자. Inference에는 detect.py를 이용한다. !python detect.py --weights /content/yolov5/runs/train/test/weights/best.pt --source /content..

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Train

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : Train

    이전 글에서는 Yolo 모델을 위한 데이터셋을 만들었다. https://minmiin.tistory.com/14 [Yolo] Custom Dataset으로 Yolo 돌려보기 : 데이터셋 준비 이전에 Custom Dataset을 통해 yolo를 학습하는 글을 쓴 적이 있는데 다시 보니 미숙함이 너무 잘 보여서 처음부터 차근차근 써보고자 한다. 대부분의 예제 코드들은 yolov5를 이용하는 것 같고 필자도 minmiin.tistory.com 이제 본격적으로 Yolo를 train해보자! 이전 글에서 쓴 것 같이, Annotation 파일들은 개별 이미지 파일과 같은 이름을 가져야 하고, 이미지 폴더가 위치한 디렉토리 내의 /labels 폴더에 저장되어야 한다. 따라서 yolo 데이터들은 다음과 같은 구조로 저..

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기  : 데이터셋 준비

    [Yolov5] Custom Dataset으로 Yolov5 돌려보기 : 데이터셋 준비

    이전에 Custom Dataset을 통해 yolo를 학습하는 글을 쓴 적이 있는데 다시 보니 미숙함이 너무 잘 보여서 처음부터 차근차근 써보고자 한다. https://github.com/ultralytics/yolov5 GitHub - ultralytics/yolov5: YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite. Contribute to ultralytics/yolov5 development by creating an account on GitHub. github.com - 시작하기 전에 Object Detection이 뭔지, Yolo가 어떤 모델인지 알고 가면 좋다! *준비중 - 사실..

    [논문리뷰] U-Net : Convolutional Networks for Biomedical Image Segmentation

    [논문리뷰] U-Net : Convolutional Networks for Biomedical Image Segmentation

    대표적인 Semantic segmentation 모델인 U-Net에 대해 알아보자! 원문 링크 : https://arxiv.org/abs/1505.04597 U-Net: Convolutional Networks for Biomedical Image Segmentation There is large consent that successful training of deep networks requires many thousand annotated training samples. In this paper, we present a network and training strategy that relies on the strong use of data augmentation to use the available ..

    [Pytorch] Dataset 정의

    파이토치에서는 DataLoader 클래스를 통해 데이터를 편리하게 불러올 수 있다. (ex : 특정 batch size만큼씩 데이터 불러오기, shuffle, 미리 정의한 순서대로 데이터 불러오기 등) 이를 위해서는 Dataset 클래스로 데이터를 사전 정의해야 한다. import torch from torch.utils.data import Dataset 테스트를 위해 간단한 tensor 데이터를 정의하였다. x = [[0,0,0], [0,0,1], [0,1,0], [1,0,0], [0,1,1], [1,1,0], [1,0,1], [1,1,1]] y = [0, 1, 2, 3, 4, 5, 6, 7] x = torch.Tensor(x).float() y = torch.Tensor(y).long() 이제 Da..

    [Python] tqdm 이용해 모델 train 시 progress bar 표시하기

    tqdm module을 이용하면 iteration 진행 상황을 progress bar로 나타낼 수 있다. 간단한 예제는 다음과 같다. from tqdm import tqdm from time import sleep for i in tqdm(range(100)): sleep(0.1) 100%|██████████| 100/100 [00:10