Created
September 21, 2021 19:44
-
-
Save tanmayymishra/7c386605c85c8f4708f39369f7762220 to your computer and use it in GitHub Desktop.
tyre
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
tyre = ["Flat Tyre","Full Tyre","No Tyre"] | |
def Single_Image_Prediction(file): | |
#image = load_img(file, color_mode='rgb', target_size=(128, 128)) | |
image= file | |
plt.imshow(image,cmap= 'gray') | |
plt.show() | |
print(image.shape) | |
# cv.imshow('image',file) | |
# cv.waitKey(0) | |
# cv.destroyAllWimdows() | |
# image = cv.cvtColor(image, cv.COLOR_RGB2GRAY) | |
img_arr = img_to_array(image) | |
# img_arr = img_arr/255. | |
np_image = np.expand_dims(img_arr, axis=0) | |
return np_image | |
image = Single_Image_Prediction(val_generator[0][0][11]) | |
pred_value = model.predict(image) | |
print(pred_value) | |
index_value = np.argmax(pred_value,axis=1) #For categorical model | |
print(tyre[index_value[0]]) | |
image = Single_Image_Prediction(val_generator[0][0][12]) | |
pred_value = model.predict(image) | |
print(pred_value) | |
index_value = np.argmax(pred_value,axis=1) #For categorical model | |
print(tyre[index_value[0]]) | |
image = Single_Image_Prediction(val_generator[0][0][0]) | |
pred_value = model.predict(image) | |
print(pred_value) | |
index_value = np.argmax(pred_value,axis=1) #For categorical model | |
print(tyre[index_value[0]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment