Open TungXuan opened 6 years ago
Sorry for the dumb question, after analyzed the output of mode predict I got a matrix with size 1-107, which I understand is 107 scores corresponsding to each categories of data.
I see that as in the repo described, in dataset.pkl contain samples - which is list of vehicles - but the length of samples is 27496. Are those 27496 categories?
So I just want ask to what file I need to read to mapping the categories with 107 scores of output from model prediction.
@TungXuan Where did you get the final model?
Sorry for the dumb question, after analyzed the output of mode predict I got a matrix with size 1-107, which I understand is 107 scores corresponsding to each categories of data.
I see that as in the repo described, in dataset.pkl contain samples - which is list of vehicles - but the length of samples is 27496. Are those 27496 categories?
So I just want ask to what file I need to read to mapping the categories with 107 scores of output from model prediction.
Hi, may I ask did u get the correct prediction result from the model? I tried it myself on trained model, the prediction on single image is very bad
Hi JakubSochor, thanks for interesting research and this repo. It is easily to setup and run the training. I used the model (fine-tune on ResNet50) I trainied with BoxCars116l Dataset on my computer to predict on single image:
`from keras.models import load_model from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from keras.applications.resnet50 import preprocess_input from keras.applications.resnet50 import decode_predictions
path_to_model = "/home/hung/source/python/read_model/models/final_model.h5" model= load_model(path_to_model)
image = load_img("car.png", target_size=(224, 224)) image = img_to_array(image) image = image.reshape(1, image.shape[0], image.shape[1], image.shape[2]) image = preprocess_input(image)
predict = model.predict(image); label = decode_predictions(predict); print(label)`
But it got error like this ValueError:
decode_predictions
expects a batch of predictions (i.e. a 2D array of shape (samples, 1000)). Found array with shape: (1, 107) I understand that because number of class is different from origin imagenet classes. Can you prove me a way to make prediction, sorry I am new to Keras and not understand your code at all. Thank you.