SimJeg / FC-DenseNet

Fully Convolutional DenseNets for semantic segmentation.
486 stars 145 forks source link

make inference with the pre-trained model #3

Closed jugaris closed 7 years ago

jugaris commented 7 years ago

Hi,

if I just want to make inference of the pre-trained model with one of my images and I don't want to train the net, do I also have to create the function "load_data" as specified in the ReadMe ?

I would like to test the net without training it and using the weights and configuration given but when I try to run test.py I get the error: "ImportError: No module named dataset_loaders.images.camvid"

Thanks!

SimJeg commented 7 years ago

Hi, you can adapt the test.py script to make it work with your images.

-- Instructions to obtain the output Y for an input batch X

First replace the "load data" section by X = np.load(your_images.npy) where X should be a float32 matrix of shape (n_images, 3, n_rows, n_cols), normalized in [0 1]. Then in the "compile model" section delete the metrics variable (line 46) and change the main function (line 50) : f = theano.function([net.input_var], prediction). Finally replace the "main loop" section and replace it with Y = f(X).

-- Instructions to obtain the metrics for a dataset

In this case you just need to change the "load data" section and create an iterator with the properties described in the README (section Data).