Created
July 24, 2018 15:47
-
-
Save xerxes01/2eadae95c807492b5fc5aa0dfa806f1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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