YAD2K icon indicating copy to clipboard operation
YAD2K copied to clipboard

Functional darknet model not detecting any boxes after conversion

Open annieke opened this issue 5 years ago • 1 comments

Hello!

I trained my own custom model on 1136 images (so a very small dataset) to detect pedestrian crossing signals, and it has been functional on our test images in darknet: predictions

However, after converting to Keras and running test_yolo.py, the converted model consistently finds 0 boxes in any of the images that are correctly boxed and classified on the darkent model.

My model is trained on Tiny YOLO, and I have already made the fix on #83. I've also trained the exact same Tiny YOLO model on the Bosch dataset, which converted successfully and is able to detect the same boxes as its darknet counterpart.

  • What could be going wrong here? Is the small dataset potentially causing this?

Here are my logs from the conversion, which seem to be successful

(yad2kenv) ~/D/1/1/C/YAD2K ❯❯❯ python yad2k.py -p csned.cfg csned_20000.weights model_data/csned_20000.h5
Using TensorFlow backend.
Loading weights.
Weights Header:  [      0       2       0 1280000]
Parsing Darknet config.
Creating Keras model.
Parsing section net_0
Parsing section convolutional_0
conv2d bn leaky (3, 3, 3, 16)
WARNING:tensorflow:From /Users/TheMachine/Documents/18-19Senior/19S/CS98/venvs/yad2kenv/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-05-12 15:21:48.802640: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Parsing section maxpool_0
Parsing section convolutional_1
conv2d bn leaky (3, 3, 16, 32)
Parsing section maxpool_1
Parsing section convolutional_2
conv2d bn leaky (3, 3, 32, 64)
Parsing section maxpool_2
Parsing section convolutional_3
conv2d bn leaky (3, 3, 64, 128)
Parsing section maxpool_3
Parsing section convolutional_4
conv2d bn leaky (3, 3, 128, 256)
Parsing section maxpool_4
Parsing section convolutional_5
conv2d bn leaky (3, 3, 256, 512)
Parsing section maxpool_5
Parsing section convolutional_6
conv2d bn leaky (3, 3, 512, 1024)
Parsing section convolutional_7
conv2d bn leaky (3, 3, 1024, 512)
Parsing section convolutional_8
conv2d    linear (1, 1, 512, 35)
Parsing section region_0
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         (None, 416, 416, 3)       0
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 416, 416, 16)      432
_________________________________________________________________
batch_normalization_1 (Batch (None, 416, 416, 16)      64
_________________________________________________________________
leaky_re_lu_1 (LeakyReLU)    (None, 416, 416, 16)      0
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 208, 208, 16)      0
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 208, 208, 32)      4608
_________________________________________________________________
batch_normalization_2 (Batch (None, 208, 208, 32)      128
_________________________________________________________________
leaky_re_lu_2 (LeakyReLU)    (None, 208, 208, 32)      0
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 104, 104, 32)      0
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 104, 104, 64)      18432
_________________________________________________________________
batch_normalization_3 (Batch (None, 104, 104, 64)      256
_________________________________________________________________
leaky_re_lu_3 (LeakyReLU)    (None, 104, 104, 64)      0
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 52, 52, 64)        0
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 52, 52, 128)       73728
_________________________________________________________________
batch_normalization_4 (Batch (None, 52, 52, 128)       512
_________________________________________________________________
leaky_re_lu_4 (LeakyReLU)    (None, 52, 52, 128)       0
_________________________________________________________________
max_pooling2d_4 (MaxPooling2 (None, 26, 26, 128)       0
_________________________________________________________________
conv2d_5 (Conv2D)            (None, 26, 26, 256)       294912
_________________________________________________________________
batch_normalization_5 (Batch (None, 26, 26, 256)       1024
_________________________________________________________________
leaky_re_lu_5 (LeakyReLU)    (None, 26, 26, 256)       0
_________________________________________________________________
max_pooling2d_5 (MaxPooling2 (None, 13, 13, 256)       0
_________________________________________________________________
conv2d_6 (Conv2D)            (None, 13, 13, 512)       1179648
_________________________________________________________________
batch_normalization_6 (Batch (None, 13, 13, 512)       2048
_________________________________________________________________
leaky_re_lu_6 (LeakyReLU)    (None, 13, 13, 512)       0
_________________________________________________________________
max_pooling2d_6 (MaxPooling2 (None, 13, 13, 512)       0
_________________________________________________________________
conv2d_7 (Conv2D)            (None, 13, 13, 1024)      4718592
_________________________________________________________________
batch_normalization_7 (Batch (None, 13, 13, 1024)      4096
_________________________________________________________________
leaky_re_lu_7 (LeakyReLU)    (None, 13, 13, 1024)      0
_________________________________________________________________
conv2d_8 (Conv2D)            (None, 13, 13, 512)       4718592
_________________________________________________________________
batch_normalization_8 (Batch (None, 13, 13, 512)       2048
_________________________________________________________________
leaky_re_lu_8 (LeakyReLU)    (None, 13, 13, 512)       0
_________________________________________________________________
conv2d_9 (Conv2D)            (None, 13, 13, 35)        17955
=================================================================
Total params: 11,037,075
Trainable params: 11,031,987
Non-trainable params: 5,088
_________________________________________________________________
None
Saved Keras model to model_data/csned_20000.h5
Read 11037075 of 11037075.0 from Darknet weights.
Saved model plot to model_data/csned_20000.png

Thank you so much!

annieke avatar May 12 '19 20:05 annieke

Hello! I have a quession about the boxes. I wish you can tell me the information of the boxes.Whether there are (xmin,ymin,xmax,ymax,class) or other pattern? Thank you.

yuwoliang avatar Jul 11 '19 01:07 yuwoliang