0bf81caddbc64e81b8b2989e8dbb5a0ec49e489a,Security_and_MachineLearning/src/defensive_chap7/face_auth.py,,,#,11

Before Change



// Use Loss=categorical_crossentropy.
print("Compile model.")
model.compile(loss="categorical_crossentropy",
              optimizer="adam",
              metrics=["accuracy"])

// Execute face authentication.
capture = cv2.VideoCapture(0)

After Change


        cv2.imwrite(file_name, resized_face_image)

        // Transform image to 4 dimension tensor.
        img = image.img_to_array(image.load_img(file_name, target_size=(img_width, img_height)))
        x = image.img_to_array(img)
        x = np.expand_dims(x, axis=0)
        x = x / 255.0

        // Prediction.
        preds = model.predict(x)[0]
        predict_idx = np.argmax(preds)

        // Final judgement.
        judge = "Reject"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: 13o-bbr-bbq/machine_learning_security
Commit Name: 0bf81caddbc64e81b8b2989e8dbb5a0ec49e489a
Time: 2020-01-08
Author: takaesu235@gmail.com
File Name: Security_and_MachineLearning/src/defensive_chap7/face_auth.py
Class Name:
Method Name:


Project Name: BVLC/caffe
Commit Name: 9572a68b8832a09f716017742fbd3b4f1da3d131
Time: 2014-08-12
Author: jeff.donahue@gmail.com
File Name: scripts/cpp_lint.py
Class Name:
Method Name:


Project Name: BVLC/caffe
Commit Name: 16176a2d3e934528c1b6a4c80d0fc53c86ec5933
Time: 2014-04-22
Author: jeff.donahue@gmail.com
File Name: scripts/cpp_lint.py
Class Name:
Method Name: