experiencor / keras-yolo2

Easy training on custom dataset. Various backends (MobileNet and SqueezeNet) supported. A YOLO demo to detect raccoon run entirely in brower is accessible at https://git.io/vF7vI (not on Windows).
MIT License
1.73k stars 785 forks source link

Full YOLO pre-trained weights missing? #350

Closed alvin319 closed 6 years ago

alvin319 commented 6 years ago

I'm currently following the page and I couldn't find the full YOLO pre-trained weights?

bkanaki commented 6 years ago

Those are just the backends. Do you want backend or full network weights. You can load full weights from the original darknet framework using this work.

alvin319 commented 6 years ago

Thanks for the reply! I wanted to download the backend weights.

bkanaki commented 6 years ago

Here: https://github.com/rodrigo2019/keras-yolo2/releases/tag/pre-trained-weights

Thank him.

guysoft commented 5 years ago

I am getting from that repo: @rodrigo2019 perhaps you can either explain why the weights don't match to your current maser, or open the issues feature in your repo?

It loads fine when I remove the pretrained path

Redirecting full_yolo_raccoon.h5 file name to ../backup/Tiny_full_racoon_20181211095050/Tiny_full_racoon_20181211095050.h5.
Redirecting ./logs/example tensorborad log to ../backup/Tiny_full_racoon_20181211095050/logs.
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 176/176 [00:00<00:00, 13373.14it/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:00<00:00, 12389.33it/s]
Seen labels:     {'raccoon': 188}
Given labels:    ['raccoon']
Overlap labels:  {'raccoon'}
(14, 14)
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_1 (InputLayer)            (None, 448, 448, 3)  0
__________________________________________________________________________________________________
Full_YOLO_backend (Model)       (None, 14, 14, 1024) 50547936    input_1[0][0]
__________________________________________________________________________________________________
DetectionLayer (Conv2D)         (None, 14, 14, 30)   30750       Full_YOLO_backend[1][0]
__________________________________________________________________________________________________
YOLO_output (Reshape)           (None, 14, 14, 5, 6) 0           DetectionLayer[0][0]
__________________________________________________________________________________________________
GT_boxes (InputLayer)           (None, 1, 1, 1, 10,  0
__________________________________________________________________________________________________
Insert_GT_Boxes (Lambda)        (None, 14, 14, 5, 6) 0           YOLO_output[0][0]
                                                                 GT_boxes[0][0]
==================================================================================================
Total params: 50,578,686
Trainable params: 50,558,014
Non-trainable params: 20,672
__________________________________________________________________________________________________
Loading pre-trained weights in /home/ubuntu/machine_learing/keras-yolo2-rodrigo2019/full_yolo_backend.h5

Loading pre-trained weights in /home/ubuntu/machine_learning/keras-yolo2-rodrigo2019/full_yolo_backend.h5
Traceback (most recent call last):
  File "./train.py", line 137, in <module>
    _main_(args)
  File "./train.py", line 110, in _main_
    yolo.load_weights(config['train']['pretrained_weights'])
  File "/home/ubuntu/machine_learning/keras-yolo2-rodrigo2019/frontend.py", line 241, in load_weights
    self.model.load_weights(weight_path)
  File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1166, in load_weights
    f, self.layers, reshape=reshape)
  File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 1030, in load_weights_from_hdf5_group
    str(len(filtered_layers)) + ' layers.')
ValueError: You are trying to load a weight file containing 44 layers into a model with 2 layers.
rodrigo2019 commented 5 years ago

you are trying to load the backend weights into the whole model. just leave this weights in the root directory and the backend will load automatically, do not need set this path anywhere

take a look here

rodrigo2019 commented 5 years ago

Also I do not recommend to use these backend weights, in all my tests using these weights I got worst results

guysoft commented 5 years ago

Thanks! Ok understood now.

Also managing to run the raccoon example now. Loading the backend worked, will see how it handles a fresh model training and will update.

I will note I like @rodrigo2019 repo better, there are small quirks that make life easier.

guysoft commented 5 years ago

@rodrigo2019 Another question if I already caught you here: In your fork there is a file train_classification.py. What is this? Does it train the network differently? I can see its using ImageDataGenerator, which I wanted to use in a way to extend my dataset.

rodrigo2019 commented 5 years ago

the ideia of this script is about to train the backend weights using a classification network. But again, in all my tests using any kind of pre trained weights for the backend I got worst results.