question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identical & low confidence predictions

See original GitHub issue

Please make sure that the boxes below are checked before you submit your issue.

Thank you!

  • Check that you are up-to-date with the master branch of Keras. You can update with:

    pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
    
  • If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.

  • If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:

    pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
    
  • Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).

Hi, first of all, huge thanks for creating this repo and training the models!

I’m running into a weird problem, where I can’t seem to run even the most simple example:

from vgg16_places_365 import VGG16_Places365
from keras.preprocessing import image

model = VGG16_Places365(weights='places')

img_path = 'restaurant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

preds = model.predict(x)
print('Predicted:', preds)

The code above is missing the preprocess_input, so I tried with keras, pytorch and my own implementations of it (by guessing what it does). But I keep getting basically the same predictions, doesn’t matter on what image I run them on or what preprocess function I use (all from places365 dataset):

0.023 -> museum/indoor
0.023 -> coffee_shop
0.022 -> art_studio
0.021 -> campus
0.019 -> yard
0.019 -> inn/outdoor
0.016 -> science_museum
0.015 -> motel
0.015 -> building_facade
0.015 -> staircase

Not sure whether that’s a problem with my preprocess_input method or something else, but I’d really appreciate some help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
atunickcommented, Apr 26, 2018
test model code for VGG16_hybrid_places_1365:
==============================.
import keras
import numpy as np
import os
from VGG16_hybrid_places_1365 import VGG16_Hubrid_1365
from keras.preprocessing import image
from places_utils import preprocess_input
model = VGG16_Hubrid_1365(weights='places', include_top=True)
#model = VGG16_Hubrid_1365(weights='places', include_top=False)
img_path = 'restaurant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
print x.ndim, x.shape
predictions_to_return = 10
preds = model.predict(x)[0]
print 'preds', preds.ndim, preds.shape, np.sort(preds)[::-1][0:10]
top_preds = np.argsort(preds)[::-1][0:10]
print'top_preds', top_preds.ndim, top_preds.shape, top_preds
print '  '
# load the class label
file_name = 'categories_hybrid1365.txt'
if not os.access(file_name, os.W_OK):
    synset_url = 'https://raw.githubusercontent.com/CSAILVision/places365/master/categories_hybrid1365.txt'
    os.system('wget ' + synset_url)
classes = list()
with open(file_name) as class_file:
    for line in class_file:
        classes.append(line.strip().split(' ')[0][3:])
classes = tuple(classes)
print('--SCENE CATEGORIES:')
# output the prediction
for i in range(0, 10):
    print(classes[top_preds[i]])
2reactions
GKalliatakiscommented, May 31, 2018

This issue is now fixed thanks to the @pavelgonchar and his release with the correct converted weights found in landmark-recognition-challenge.

Also the README file has been updated accordingly.

This issue will now close.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comparison of Low, Medium, and High Confidence Predictions
As Table 2 (and Figure 1) t makes abundantly clear, differences in accuracy rates for high-and low-confidence judgments were far from commensurate with...
Read more >
Confidence Predictions Affect Performance ... - Nature
Confidence predictions closely tracked reported performance confidence, even when performance confidence dissociated from objective accuracy.
Read more >
How Confidence and Prediction intervals work | by Shrey Parth
Confidence Intervals are estimates that are calculated from sample data to determine ranges likely to contain the population parameter(mean, ...
Read more >
The distinction between confidence intervals, prediction ...
If you set the confidence level to a higher value (say 90% or 99%) then the tolerance interval is wider than a prediction...
Read more >
Confidence Intervals vs Prediction Intervals vs Tolerance ...
Example of a Confidence Interval · As you draw larger and larger random samples from the same population, the confidence intervals tend to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found