516c2a4c7e8f92e1ea299e966215c2ffe4c5b980,cifar10.py,,,#,14

Before Change


                   nb_val_samples=testX.shape[0], verbose=1)

scores = model.evaluate_generator(test_generator.flow(testX, testY, nb_epoch), testX.shape[0])
print("Accuracy = %f" % (100 * scores[1]))
print("Error = %f" % (100 - 100 * scores[1]))

After Change


(trainX, trainY), (testX, testY) = cifar10.load_data()

trainX = trainX.astype("float32")
testX = testX.astype("float32")

trainX /= 255.
testX /= 255.

Y_train = np_utils.to_categorical(trainY, nb_classes)
Y_test = np_utils.to_categorical(testY, nb_classes)

generator = ImageDataGenerator(rotation_range=15,
                               width_shift_range=5./32,
                               height_shift_range=5./32)

generator.fit(trainX, seed=0)

// Load model
model.load_weights("weights/DenseNet-40-12-CIFAR10.h5")
print("Model loaded.")

// model.fit_generator(generator.flow(trainX, Y_train, batch_size=batch_size), samples_per_epoch=len(trainX), nb_epoch=nb_epoch,
//                    callbacks=[ModelCheckpoint("weights/DenseNet-40-12-CIFAR10.h5", monitor="val_acc", save_best_only=True,
//                                               save_weights_only=True)],
//                    validation_data=(testX, Y_test),
//                    nb_val_samples=testX.shape[0], verbose=2)

yPreds = model.predict(testX)
yPred = np.argmax(yPreds, axis=1)
yTrue = testY

accuracy = metrics.accuracy_score(yTrue, yPred) * 100
error = 100 - accuracy
print("Accuracy : ", accuracy)
print("Error : ", error)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 4

Instances


Project Name: titu1994/DenseNet
Commit Name: 516c2a4c7e8f92e1ea299e966215c2ffe4c5b980
Time: 2016-12-07
Author: titu1994@gmail.com
File Name: cifar10.py
Class Name:
Method Name:


Project Name: IndicoDataSolutions/finetune
Commit Name: cb89711536f566f3ed7d121520fe32ad41ca83bc
Time: 2019-01-11
Author: benlt@hotmail.co.uk
File Name: finetune/association.py
Class Name: Association
Method Name: predict


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 32227845a3201f223ffee61218453fcb6a93eb3b
Time: 2019-05-07
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/utils_unittest.py
Class Name: TestUtils
Method Name: test_iris


Project Name: pythonstock/stock
Commit Name: 04d0a9bbfc085d244ee5abed1e4591202a8bd4cb
Time: 2017-10-26
Author: yhy
File Name: web/minstServingHandler.py
Class Name:
Method Name: do_inference


Project Name: nipy/dipy
Commit Name: bd300edf778f2a5687e41416f2798ebb519f496c
Time: 2020-11-11
Author: shreyasfadnavis@gmail.com
File Name: dipy/denoise/patch2self.py
Class Name:
Method Name: patch2self