-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiscale support #2
Comments
Hey Jacob, thanks for your input! My training data contains tanks in various sizes, i.e. shot from medium to long-distance as well, but you're absolutely right: opting for convolutional instead of fully-connected layers would probably make the model more robust to changes in target size. I'll give this a try really soon! |
Hi @jacobgil, I've been exploring this issue, but I have trouble wrapping my head around the idea of converting the dense layer to a convolutional one using previously trained weights, despite spending quite a lot of time looking at the repo you referred to: how can I reconstruct (or reshape) the weights once they have been flattened? |
I've been experimenting with converting the final layers of the model from dense to convolutional, adding another network architecture to nets.py under MiniVGGNetFC. The initial work can be found in fcn_test.py. For reshaping the pre-trained weights, I've adopted the solution proposed for producing heatmaps in the repo referenced above:
When attempting to load the weights using the Keras `model.load_weights()' function, the weights for the first dense layer (dense_1) are loaded successfully, but the second set of weights for the layer dense_2 returns the following error:
Does this mean the pre-trained weights for the second layer have to be reshaped and set manually? If so, how to do this? |
Hi,
Fun project:)
Just a small suggestion -
I think that an issue is that the current model assumes that the objects (Tanks) are large enough.
If you"l want to use this for other types of weapons, like AK-47s, you will need the ability to support different scales, since ak-47s might occupy only a small part of the image.
One relatively easy way of doing that (without training an actual object localization network) is converting the last fully connected layers to convolutional layers (each filter size should be set the size of the output of previous layer).
i.e instead of using Flatten() and Dense(), use Convolution2D with appropriate filter sizes, when not in training.
Similarly to the heatmap option here: https://github.com/heuritech/convnets-keras.
This applies the classifier in a sliding window fashion, and you can then feed the classifier larger images and process the output.
This can be done without retraining, using the existing model weights.
The text was updated successfully, but these errors were encountered: