Open hngskj opened 4 years ago
The trained model weights: PASCAL VOC models (07++12+COCO: SSD300) Reference: ssd300_inference.ipynb
There are two ways to load the trained model: load_model()
and load_weights()
.
As mentioned here, load_model()
assumes that the model has whole information such as the architecture, weights, and optimizer state. To generate the whole model, the model should be saved with save()
function.
On the other hand, load_weights()
only needs the weights of the model excluding the architecture and optimizer state. It means that those two parts must be written in the code before load_weights()
function.
It seems like ssd_keras only supports the trained model with weights. So, as I understand, load_weights()
is the only option for now.
Below is the output image from this model :)
@hngskj That's a really good summary ππ» I can follow all of your work well.
As you mentioned, if ssd_keras supports only weights, should we train the model with supported weights and save()
the final model?
ps. cats are so cuuuute!! π±
@MijeongJeon
At your suggestion, I saved the whole model containing weights as well as the architecture and optimizer state. Then I loaded that whole model using load_model()
function and tested it out.
Interestingly, the outputs of the two models are slightly different. The classes and the confidence levels are the same, but as you can see below, the coordinate of bounding boxes are not exactly the same. Quite not sure why this issue happens, let me dive into this later on. However, the image looks almost the same, I guess?
πππππππππππππππππππππππππ
load_weights(βonly_weights.h5β) Predicted boxes:
class | conf | xmin | ymin | xmax | ymax |
---|---|---|---|---|---|
8 | 0.94 | 54.61 | 135.11 | 133.66 | 303.04 |
8 | 0.9 | 249.14 | 104. | 302.91 | 248.93 |
8 | 0.88 | 168.5 | 208.52 | 241.3 | 307.45 |
8 | 0.86 | 260.67 | 213.06 | 310.04 | 316.81 |
8 | 0.73 | 205.83 | 167.62 | 266.63 | 297.22 |
8 | 0.67 | 2.99 | 141.31 | 68.14 | 282.75 |
8 | 0.57 | 21.05 | -1.43 | 58.17 | 97.75 |
8 | 0.56 | 98.68 | 51.69 | 148.25 | 155.53 |
8 | 0.53 | 236.5 | 1.19 | 302.14 | 93.76 |
8 | 0.52 | 28.37 | 56.95 | 78.25 | 162.82 |
load_model(βwhole_model.h5β) Predicted boxes:
class | conf | xmin | ymin | xmax | ymax |
---|---|---|---|---|---|
8 | 0.94 | 49.61 | 122.11 | 128.66 | 290.04 |
8 | 0.9 | 232.14 | 93. | 285.91 | 237.94 |
8 | 0.88 | 165.86 | 205.05 | 238.67 | 303.97 |
8 | 0.86 | 256.99 | 209.59 | 306.36 | 313.34 |
8 | 0.73 | 190.83 | 152.62 | 251.63 | 282.22 |
8 | 0.67 | -0.01 | 128.31 | 65.14 | 269.75 |
8 | 0.57 | 20.52 | -2.16 | 57.65 | 97.02 |
8 | 0.56 | 97.1 | 50.32 | 146.67 | 154.16 |
8 | 0.53 | 233.03 | 0.66 | 298.67 | 93.23 |
8 | 0.52 | 27.64 | 55.58 | 77.51 | 161.45 |
Load SSD model
To-do list