Skip to content

Instantly share code, notes, and snippets.

@xerxes01
Created July 24, 2018 15:47
Show Gist options
  • Save xerxes01/2eadae95c807492b5fc5aa0dfa806f1d to your computer and use it in GitHub Desktop.
Save xerxes01/2eadae95c807492b5fc5aa0dfa806f1d to your computer and use it in GitHub Desktop.
import numpy as np
from keras.models import load_model
from keras.applications.resnet50 import preprocess_input
def channel_axis(self):
return 3
def predictions(self, image):
image=image[:,:,::-1]
prediction = np.argmax(self.predictions(image))
return prediction
def bounds(self):
return (0, 255)
def create_fmodel():
model = keras.load_model('/home/shikhar/notebooks/resnet18_tiny_imagenet_standard.h5')
preprocessing = (np.array([104, 116, 123]), 1)
fmodel=foolbox.models.KerasModel(model, bounds=(0, 255), preprocessing=preprocessing)
return fmodel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment