Yan Ming
Yan Ming

Reputation: 58

Error: l.outputs == params.inputs filters= in the [convolutional]-layer doesn't correspond to classes= or mask= in [yolo]-layer

I want to train a yolov3-tiny weights. I use darknet commands for training. Previously, I set the filter in the cfg file according to the number of classes, and set the number of classes in the data file. Finally, I used yolov3-tiny. Pre-training weights for training, but still report errors, please help.

This is the data file:

classes = 1
train = data/train_crosswalk_pos.txt
valid = data/val_crosswalk_pos.txt
names = data/crosswalk_pos.names
backup = backup/

This is the names file:

crosswalk

This is the cfg file:

[net]
# Testing
#batch=1
#subdivisions=1
# Training
batch=24
subdivisions=8
width=416
height=416
channels=1
momentum=0.9
decay=0.0005
angle=30
saturation = 1.5
exposure = 1.8
hue=.2

learning_rate=0.001
burn_in=1000
max_batches = 10000
policy=steps
steps=8000,9000
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 = 10,14,  23,27,  37,58,  81,82,  135,169,  344,319
classes=1
num=6
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 = 10,14,  23,27,  37,58,  81,82,  135,169,  344,319
classes=1
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1

Upvotes: 1

Views: 3392

Answers (2)

Mohit Gaikwad
Mohit Gaikwad

Reputation: 340

Your query is for yolov3, I am mentioning yolov4, probably the same.

In your case:

classes: 1 (in Yolo layers) max_batches: 10000 steps: 8000,9000 filters:18

Instead, it should:

classes: 1 (in Yolo layers) max_batches: 6000 steps: 4800 5400 filters:18

Upvotes: 0

Agnij
Agnij

Reputation: 581

There are some more configurations to be made in the cfg file,

Set

  1. Search for phrase 'yolo' and in the above convolution layer set filters = (num classes + 5) *3.

Note. This will need to be done in 3 places, for classes = 1, filters will be 18

  1. Max_batches needs to be (num classes * 2000), minimum 4000, in this scenario it needs to be 4000.

  2. Steps, below max_batches needs to be 80%, 90% of Max batches value, so here it should be 3200, 3600.

Upvotes: 3

Related Questions