-
Notifications
You must be signed in to change notification settings - Fork 2k
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
how to modify anchor box? #421
Comments
Currently there is no easy method to configure this (see #324). Anchors are generated in two places unfortunately, once for creating the target data (which is the one you edited) and once for inference, which is the one you didn't edit: https://github.com/fizyr/keras-retinanet/blob/master/keras_retinanet/layers/_misc.py#L31-L45 |
Ah that would work for training, but it would still break when doing inference. It reminded me that my previous comment was wrong though, for inference it is better to create an AnchorParameters object like this : anchor_parameters = keras_retinanet.models.retinanet.AnchorParameters(
sizes = [32, 64, 128, 256, 512],
strides = [8, 16, 32, 64, 128],
ratios = np.array([0.5, 1, 2], keras.backend.floatx()), # Change this for your ratios
scales = np.array([2 ** 0, 2 ** (1.0 / 3.0), 2 ** (2.0 / 3.0)], keras.backend.floatx()), # Change this for your scales
) Which you then should be able to pass to this line like so: model = model_with_weights(backbone_retinanet(num_classes, backbone=backbone, modifier=modifier, anchor_parameters=anchor_parameters), weights=weights, skip_mismatch=True) I haven't tried this yet though, so I don't know if it works or not.. |
ok, i see, thank you so much!!!! |
hello,i want to modify ratio of anchor(i need 7 ratio),but when i modify anchor in util/anchor.py,it cause some problem,what parameters should i modily?
![image](https://user-images.githubusercontent.com/17508662/39111009-ee68903c-4705-11e8-9dae-c32d4dbc933f.png)
The text was updated successfully, but these errors were encountered: