Skip to main content

Image Identify using machine learning in Python.


#pip install imageai
#pip install Tensorflow
#pip install keras

from imageai.Prediction import ImagePrediction
import os
from keras.models import load_model
Givenimage="picc.jpg"

execution_path=os.getcwd()
#print(execution_path)

prediction = ImagePrediction()
prediction.setModelTypeAsSqueezeNet()
prediction.setModelPath(os.path.join(execution_path, "squeezenet_weights_tf_dim_ordering_tf_kernels.h5"))


prediction.loadModel()

predictions, probabilities = prediction.predictImage(os.path.join(execution_path, Givenimage), result_count=3 )
for eachPrediction, eachProbability in zip(predictions, probabilities):

    print(eachPrediction , " : " , eachProbability) 


Result:

WARNING:tensorflow:11 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x7f941e211598> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has experimental_relax_shapes=True option that relaxes argument shapes that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/tutorials/customization/performance#python_or_tensor_args and https://www.tensorflow.org/api_docs/python/tf/function for more details. lion : 99.9810516834259 brown_bear : 0.004735136099043302 Airedale : 0.004706834806711413

## Programme is 99.98 % sure that it was Lion , Thats Great!





feel free to contact Regarding https://t.me/dharambirpoddar

Comments

Post a Comment

Popular posts from this blog

Use of formula loop plot of graph y=sin(x)/x and y=sin(x^2)/x in LabVIEW

1. Formula loop Using formula loop compute y for the following two functions: 𝑦1 = sin(x)/x and 𝑦2 = sin(x2)/x where x varies from 0 to 10 in step of 0.05. Plot 𝑦1 & 𝑦2 vs. x in a single XY graph. Use For Loop and Formula loop for this problem.

Make a Translator using python?

CODE : pip install translate create a new script file eg. english in the same directory. from translate import Translator translator=Translator( to_lang = "hi" ) with open ( './english.txt' , 'r' ) as file2: text=file2.read() translation=translator.translate(text) print(translation) or another way  jj= str ( input ( 'enter th english' )) from translate import Translator translator=Translator( to_lang = "hi" ) with open ( './english.txt' , 'w' ) as file2: file2.write( f'-- { jj } ' ) with open ( './english.txt' , 'r' ) as file2: text = file2.read() translation=translator.translate(text) print (translation) DEMO: