반응형

github 소스 

 

GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors - GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of...

github.com

 

소스 다운하기 :

!git clone https://github.com/WongKinYiu/yolov7.git

이동하기 :

%cd yolov7

lib 설치하기

!pip install -U -r requirements.txt

1. Yolov7 coco dataset 학습하기 

 

train: WARNING: Ignoring corrupted image and/or label coco/images/train2017/000000189778.jpg: [Errno 2] No such file or directory: 'coco/images/train2017/000000189778.jpg'

./data/coco.yaml을 수정한다. 

# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: ./data/coco/train2017.txt  # 118287 images
val: ./data/coco/val2017.txt  # 5000 images
test: ./data/coco/test-dev2017.txt  # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794

 

github에서 수정하지 한다 .

!python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

정상적으로 수행하는 것을 확인할 수 있다. 

default 값은 아래와 같다. 

YOLOR 🚀 v0.1-115-g072f76c torch 1.12.1+cu113 CUDA:0 (Tesla T4, 15109.75MB) Namespace(adam=False, artifact_alias='latest', batch_size=32, bbox_interval=-1, bucket='', cache_images=False, cfg='cfg/training/yolov7.yaml', data='data/coco.yaml', device='0', entity=None, epochs=300, evolve=False, exist_ok=False, freeze=[0], global_rank=-1, hyp='data/hyp.scratch.p5.yaml', image_weights=False, img_size=[640, 640], label_smoothing=0.0, linear_lr=False, local_rank=-1, multi_scale=False, name='yolov7', noautoanchor=False, nosave=False, notest=False, project='runs/train', quad=False, rect=False, resume=False, save_dir='runs/train/yolov7', save_period=-1, single_cls=False, sync_bn=False, total_batch_size=32, upload_dataset=False, v5_metric=False, weights='', workers=8, world_size=1) tensorboard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ hyperparameters: lr0=0.01, lrf=0.1, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.3, cls_pw=1.0, obj=0.7, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.2, scale=0.9, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.15, copy_paste=0.0, paste_in=0.15, loss_ota=1 wandb: Install Weights & Biases for YOLOR logging with 'pip install wandb' (recommended)

여기에서 알 수 있다 싶이 epochs 가 300이다 . 

1-1. epochs 수정해서 수행하기 

!python train.py --workers 8 --epochs 1 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

 

반응형

'Deep learning > 소스' 카테고리의 다른 글

yolov5 Multi-GPU Training  (0) 2021.09.22
yolov5 coco data set training  (0) 2021.09.17
classification mnist-LeNet-5  (0) 2021.04.03
yolov5 모델pt  (0) 2021.03.26
classification model code  (0) 2021.01.14
반응형

https://github.com/ultralytics/yolov5/issues/475

 

Multi-GPU Training 🌟 · Issue #475 · ultralytics/yolov5

📚 This guide explains how to properly use multiple GPUs to train a dataset with YOLOv5 🚀 on single or multiple machine(s). UPDATED 18 August 2021. Before You Start Clone repo and install requiremen...

github.com

 

1. DataParallel

 

시간 확인 : 0.293 hours

 

2. DistributedDataParallel

시간 확인 : 0.269 hours

 

DistributedDataParallel 를 추천 한다고 되여 있는데 시간도 빠르다.

 

 

DataParallel와  DistributedDataParallel 의 비교 :

https://algopoolja.tistory.com/56

 

torch.distributed

torch로 병렬화를 하기 위해서 torch에서 제안하는 몇가지 선택할 수 있는 선택지가 있다. 1. torch.nn.DataParallel DataParallel은 하나의 본체에서 multi-GPU 병렬화를 코딩을 많이 하지 않고 할 수 있는 선택.

algopoolja.tistory.com

 

반응형

'Deep learning > 소스' 카테고리의 다른 글

Yolov7 학습하기  (0) 2022.10.21
yolov5 coco data set training  (0) 2021.09.17
classification mnist-LeNet-5  (0) 2021.04.03
yolov5 모델pt  (0) 2021.03.26
classification model code  (0) 2021.01.14
반응형

1. 먼저 yolov5를 다운한다.

yolov5관련된 lib도 설치한다.

!git clone https://github.com/ultralytics/yolov5 # clone repo
%cd yolov5
!pip install -U -r requirements.txt

2. yolov5/data/coco.yaml수정

path: ./datasets/coco

경로 수정

 

3. train 실행

!python train.py --data coco.yaml --epoch 1

 

 

 

참고 사이트 :

https://stackoverflow.com/questions/55556965/importing-coco-datasets-to-google-colaboratory

 

Importing COCO datasets to google colaboratory

The COCO dataset is very large for me to upload it to google colab. Is there any way I can directly download the dataset to google colab?

stackoverflow.com

 

반응형

'Deep learning > 소스' 카테고리의 다른 글

Yolov7 학습하기  (0) 2022.10.21
yolov5 Multi-GPU Training  (0) 2021.09.22
classification mnist-LeNet-5  (0) 2021.04.03
yolov5 모델pt  (0) 2021.03.26
classification model code  (0) 2021.01.14
반응형

Activation function : ReLU

GPU 2개 병렬

Local Response norm

overlapping pooling

data augmentatin

dropout

 

모델 구조

반응형

'Deep learning > Image Classfication 모델 간략하게 소개' 카테고리의 다른 글

LeNet-5  (0) 2021.08.26
반응형

손글씨 숫자를 인식하는 네트워크로 , 1998년에 제안 

Yann LeCun

합성곱 계층과 풀링 계층(정확히는 단순히 '원소를 줄이기'만 하는 서브샘플링 계층)을 반복하고 , 마지막으로 완전 연결 계층을 거치면서 결과를 출력

LeNet과 현재의 CNN과의 차이점

  • LeNet는 활성화함수 :시그모이드 함수를 사용하고 현재는 ReLU를 사용한다.
  • LeNet는 서브샘플링을 하여 중간데이터 크기가 작아지지만 현재는 최대 풀링이 주류다.

 

 

출처 : 밑바닥 부터 딥러닝

 

LeCun에 의해 고안됨

입력으로 32x32 픽셀 크기의 이미지를 받음

C1, C3, C5: 컨볼루션 ( 5X5 크기의 Feature map)

S2, S4 : 풀링 ( 인자 2에 의한 풀링, 피처의 크기가 절반으로 축소)

F6: 단층 신경망 (fully-connected)

 

장점: 물체의 위치와 각도 변화에 대한 불변성

         노이즈와 왜곡에 대한 불변성

 

단점 :

메모리 관점에서 일반적인 다층 프셉트론보다 더 많은 용량을 차지함( 많은 수의 파라미터)

실행시간 관점에서 컨볼루션 과정이 많은 계산을 필요하고 전체 실행 시간 중 약 2/3의 비중을 차지

같은 개수의 파라미터를 갖는 신경망보다 3배 가까이 실행시간이 느림

 

https://www.youtube.com/watch?v=_6GwLjW9sbc&list=PL9mhQYIlKEheuxhyGbUIpKR1EFM-o0Br1&index=9

 

반응형

'Deep learning > Image Classfication 모델 간략하게 소개' 카테고리의 다른 글

AlexNet  (0) 2021.09.04
반응형

https://chacha95.github.io/2019-04-04-logit/

 

Sigmoid, Logit and Softmax

딥러닝 모델의 마지막 노드들에 출력되는 값을 바꿀 때 왜 logit함수와 softmax를 쓸가요? neural net을 이용한 classification task에 서의 맨 마지막 레이어의 노드들을 생각해 봅시다. 마지막 레이어에 act

chacha95.github.io

https://opentutorials.org/module/3653/22995

logistic + probit  = logit

log + odds

probit은 확률을 재는 단위

odds:  (두 확률의 비율)를 그대로 가져온다고 보시면 됨

 

odds: 그 값이 1보다 큰지 아닌지로 결정의 기준을 세웠다면 

logit은 그 값이 0보다 큰지 아닌지로 결정의 기준을 세웁니다. 

이 두 식은 완전히 같은 의미를 갖는데 , x = 1은 log x는 0이기 때문입니다. 

 

odds, 도박에서 얻을(pay off) 확률과 잃을(stake) 확률의 비율을 뜻하는 영어단어입니다.

반응형

'Deep learning > 개념' 카테고리의 다른 글

개념  (0) 2021.03.29
loss function  (0) 2021.03.27
Optimizer  (0) 2021.03.27
Activation Function  (0) 2021.03.27
DBN  (0) 2021.03.27
반응형

Linear Regression 의 cost 최소화의 TensorFlow 구현(new)

X = [1, 2, 3]
Y = [1, 2, 3]

W= tf.Variable(5.0) # 말도 안되는 값을 준다.
hypothesis = X * W
gradient = tf.reduce_mean((W * X - Y) * X) * 2

cost = tf.reduce_mean(tf.square(hypothesis - Y))
optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.01)

gvs = optimizer.compute_gradients(cost,[W])
apply_gradients = optimizer.apply_gradients(gvs)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
for step in range(101):
    print(step, sess.run([gradient, W,gvs]))
    sess.run(apply_gradients)

 

gvs = optimizer.compute_gradients(cost) -> gvs = optimizer.compute_gradients(cost,[W]) 으로 수정

 

참고 :

https://kswims.tistory.com/97

 

[Lec03] Linear Regression의 cost 최소화 알고리즘의 원리 설명

오늘은 'cost function을 어떻게 최소화해서 학습을 시킬 것인가'를 알아보도록 하겠다. 우리가 학습시키는 Hypothesis는 H(x) = Wx+b로 주어진다. 이걸 통해서 만들어 낼 수 있는 식 cost(W,b)는 예측값과

kswims.tistory.com

 

반응형
반응형

해결 

https://kyumdoctor.co.kr/18

 

gpu 버전 차이 때문에 나는 에러이다.

해결 방법은 두가지 이다.

 

1. nvidia-docker run 

2. docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=2,3

 

 

 

 

반응형

+ Recent posts