You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mr. Moroney, I always get a lot of help from your great courses. Thank you. ^^
The following is the result of ##Running the Model in Course 1 - Part 8 - Lesson 3 - which I modified and executed.
I modified the source code a little because I wanted to check the results on local PC.
The execution result is MISS CLASSIFICATION RATIO: 14.0625
This is the rate at which a horse image is judged to be human or a person image is judged to be a horse.
I think the rate of misjudgment is higher than expected.
How do I get this ratio close to zero percent?
------ modified source code "##Running the Model in Course 1 - Part 8 - Lesson 3 " -------
import numpy as np
#from google.colab import files
from tensorflow.keras.preprocessing import image
#uploaded = files.upload()
#for fn in uploaded.keys():
total_image_cnt = len(os.listdir(validation_horse_dir)) + len(os.listdir(validation_human_dir))
miss_classification_count = 0
for valid_image in valid_image_list:
for image_name in valid_image['images']:
# predicting images
path = '{}/{}'.format(valid_image['path'], image_name)
#print("path:{}".format(path))
img = image.load_img(path, target_size=(300, 300))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
images = np.vstack([x])
classes = model.predict(images, batch_size=10)
#print(classes[0])
if classes[0] > 0.5:
if image_name.find("horse") > -1:
miss_classification_count += 1
res = "WRONG"
else:
res = "CORRECT"
print("{} {} is a human : {}".format(classes[0], path, res))
else:
if image_name.find("human") > -1:
miss_classification_count += 1
res = "WRONG"
else:
res = "CORRECT"
print("{} {} is a horse : {}".format(classes[0], path, res))
print("MISS CLASSIFICATION RATIO : {}".format((miss_classification_count / total_image_cnt) * 100))
The text was updated successfully, but these errors were encountered:
Mr. Moroney, I always get a lot of help from your great courses. Thank you. ^^
The following is the result of ##Running the Model in Course 1 - Part 8 - Lesson 3 - which I modified and executed.
I modified the source code a little because I wanted to check the results on local PC.
The execution result is MISS CLASSIFICATION RATIO: 14.0625
This is the rate at which a horse image is judged to be human or a person image is judged to be a horse.
I think the rate of misjudgment is higher than expected.
How do I get this ratio close to zero percent?
------ modified source code "##Running the Model in Course 1 - Part 8 - Lesson 3 " -------
import numpy as np
#from google.colab import files
from tensorflow.keras.preprocessing import image
#uploaded = files.upload()
#for fn in uploaded.keys():
valid_image_list = [ { 'path': validation_horse_dir, 'images': os.listdir(validation_horse_dir) },
{ 'path': validation_human_dir, 'images': os.listdir(validation_human_dir) }]
total_image_cnt = len(os.listdir(validation_horse_dir)) + len(os.listdir(validation_human_dir))
miss_classification_count = 0
for valid_image in valid_image_list:
for image_name in valid_image['images']:
# predicting images
path = '{}/{}'.format(valid_image['path'], image_name)
#print("path:{}".format(path))
img = image.load_img(path, target_size=(300, 300))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
print("MISS CLASSIFICATION RATIO : {}".format((miss_classification_count / total_image_cnt) * 100))
The text was updated successfully, but these errors were encountered: