user40929
user40929

Reputation: 39

How to test your model on Retinanet?

I am using the Retinanet model to train a classifier with about 50 classes. Link to the model: https://github.com/fizyr/keras-retinanet

This is what I have done so far:

  1. Installed the model using the suggested steps.
  2. Create a csv of my images with the recommended format for reading.
  3. Used the following script to train my model:

    # Using the installed script:
    retinanet-train csv <path to csv file containing annotations> <path to csv file containing classes>
    
  4. The model is currently running and training with about 50 epochs and 10000 steps in each epoch. I see the losses going down and it should take about a day to finish the training.

How do I proceed now with:

a. Testing my model? The example given here:

An example of testing the network can be seen in this (https://github.com/fizyr/keras-retinanet/blob/master/examples/ResNet50RetinaNet.ipynb link on the website is dead, this seems appropriate) Notebook. In general, output can be retrieved from the network as follows:

    _, _, detections = model.predict_on_batch(inputs)

Where detections are the resulting detections, shaped (None, None, 4 + num_classes) (for (x1, y1, x2, y2, cls1, cls2, ...)).

Loading models can be done in the following manner:

    from keras_retinanet.models.resnet import custom_objects
    model = keras.models.load_model('/path/to/model.h5',                 
    custom_objects=custom_objects)

Execution time on NVIDIA Pascal Titan X is roughly 55msec for an image of shape 1000x600x3.

Now during the training, I did not do anything while running my model:

Create generators for training and testing data (an example is show in keras_retinanet.preprocessing.PascalVocGenerator).

Am I missing something?

Again, sorry for the multi-fold questions and thank you for helping me out.

Upvotes: 1

Views: 3669

Answers (1)

Hans Gaiser
Hans Gaiser

Reputation: 376

If by testing you mean running your own image through the network, have a look at the new example. All it does is setup the environment, load in the model, load and prepare an image and visualize the results.

https://github.com/fizyr/keras-retinanet/blob/master/examples/ResNet50RetinaNet.ipynb

Is there an issue with that example? Or is it not clear?

Upvotes: 3

Related Questions