parap1uie-s / Keras-RFCN

RFCN implement based on Keras&Tensorflow
MIT License
71 stars 23 forks source link

Test #5

Closed foocker closed 6 years ago

foocker commented 6 years ago

when i load the last weights file to test, some wrong like: ile "/notebooks/Keras-RFCN/KerasRFCN/Model/BaseModel.py", line 87, in load_weights saving.load_weights_from_hdf5_group_by_name(f, layers) File "/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py", line 1018, in load_weights_from_hdf5_group_by_name str(weight_values[i].shape) + '.') ValueError: Layer #371 (named "score_map_class_0"), weight <tf.Variable 'score_map_class_0/kernel:0' shape=(1, 1, 256, 423) dtype=float32_ref> has shape (1, 1, 256, 423), but the saved weight has shape (90, 256, 1, 1). and how to use the function : compute_ap(), compute_recall() to get a test report table is not clear. can only help?

parap1uie-s commented 6 years ago

hi, @foocker

The shape (423) in score map, it is defined by the class_num and the grid num k.

The parameter k define " how many mini grid we cut the Feature map in the ROI stage"

As our readme shows:

image

There would be 3x3 =9 grids in ROI.

And in our Demo of the Fashion dataset, we have 46 classes of boxes and 1 additional background class, so we have 47.

scoremap_shape = class_num k k

423 = 47 3 3

As for your issue, you have the shape 90:

90 = 10 3 3

So I guess you apply this framework to your own dataset, which has 10 classes.

It is obviously, you can't transfer the weights from one dataset to another dataset, without any transfer learning. Thus, you need to modify the class_num in your train script, and retrain the model, from the release Fashion Weights if you like.

As for the compute_ap(), compute_recall(), right now they are the Utils for training. And I will add the evaluation callback which eval the mAP after each epoch.