AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.6k stars 7.95k forks source link

Configuration to detect small objects with tiny model #2283

Open phamngocthanhtrung opened 5 years ago

phamngocthanhtrung commented 5 years ago

Hi, my goal is to detect traffic lights, can I see it as a small object? I trained a yolo-tiny-model with 7300 Images for one class.

  1. my first question is how can I increase the accuracy? AlexeyAB says in his documentation that the accuracy would increase if you also increase the resolution. Can I also change something else?
  2. So my second question is how to set the batch and subdivisions so to run the training on a GPU with 8GB of RAM, If I increase the resolution to 832 ? I'm using GTX 1080

My configuration looks like this

[net]
#Testing
batch=64
subdivisions=16
#Training
#batch=64
#subdivisions=2
width=608
height=608
channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

learning_rate=0.001
burn_in=1000
max_batches = 500200
policy=steps
steps=400000,450000
scales=.1,.1

[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=2

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[maxpool]
size=2
stride=1

[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky

###########

[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky

[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear

[yolo]
mask = 3,4,5
anchors = 4,9,  5,2,  8, 18,  9,21,  11,28,  15,33,  16,38,  19,38,  20,47
classes=1
num=9
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1

[route]
layers = -4

[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky

[upsample]
stride=2

[route]
layers = -1, 8

[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky

[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear

[yolo]
mask = 0,1,2
anchors = 4,9,  5,2,  8, 18,  9,21,  11,28,  15,33,  16,38,  19,38,  20,47
classes=1
num=9
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1

Makefile

GPU=1 CUDNN=1 CUDNN_HALF=0 OPENCV=1 AVX=0 OPENMP=0 LIBSO=1

AlexeyAB commented 5 years ago

@phamngocthanhtrung Hi,

  1. Use this cfg-file: https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov3-tiny_3l.cfg

  2. set batch=64 subdivisions=64

phamngocthanhtrung commented 5 years ago

@AlexeyAB Hi, many thanks for the help.

can I use backup-weights for retraining if I have changed the yolo-tiny to yolo-tiny-3l and the resolution? Generally in which case I can use the backup-weights to retrain the net?