super(NamedImageTransformerBaseTestCase, cls).setUpClass()
cls.appModel = keras_apps.getKerasApplicationModel(cls.name)
shape = cls.appModel.inputShape()
imgFiles, images = getSampleImageList()
imageArray = np.empty((len(images), shape[0], shape[1], 3), "uint8")
for i, img in enumerate(images):
assert img is not None and img.mode == "RGB"
imageArray[i] = np.array(img.resize(shape))
cls.imageArray = imageArray
// Predict the class probabilities for the images in our test library using keras API
// and cache for use by multiple tests.
After Change
imgFiles, imageArray = cls.getSampleImageList()
cls.imageArray = imageArray
cls.imgFiles = imgFiles
cls.fileOrder = {imgFiles[i].split("/")[-1]: i for i in range(len(imgFiles))}
// Predict the class probabilities for the images in our test library using keras API
// and cache for use by multiple tests.
preppedImage = cls.appModel._testPreprocess(imageArray.astype("float32"))
cls.preppedImage = preppedImage