Skip to main content

Start using TensorFlow for image classifier

We have set up TensorFlow environment and successfully compile on our PC. Now let us start using the tensorflow for classifying the image.
1. Open the PC command prompt.
2. key in "git clone https://github.com/tensorflow/models.git" to start to clone TensorFlow Models into your PC.
3. Now access the model's path by key-in "cd models/tutorials/image/imagenet", then try run the modules script by key in "python classify_image.py"
4. you will get the output below if the script compile is a success.
But.... if output this, then follow step5- step7 to fix it before proceeding.
Step 5: This error is caused by Tensorflow version installed on your PC not yet support for the module. So key in "pip uninstall tensorflow" to uninstall tensorflow from your system.
For example, my PC installed tensorflow 2.00, then i need to downgrade to others version of tensorflow.  You can refer to official site < Topic: tested build configurations> for relateTensorFlow version.
Step 6: Reinstall Tensorflow (version 1.9), key in" pip install --ignore-installed --upgrade tensorflow==1.9"
Step 7: Please follow step 3 again once install tensorflow version1.9 was a success.

Now let start  test TensorFlow Image Claaification on PC.
Step 1: Download image from google Example, i download image Rocket and Ice Cream from google then rebame it as images and images2. Then save these image on "C:\Users\csheng\models\tutorials\image\imagenet"
Step 2:  start to verify the images by key in "imagenet>python classify_image.py --image_file images2.jpeg". Then you will get output here.
Step 2:  start to verify the images2 by key in "python classify_image.py --image_file images.jpg". Then you will get output here.

Done!!

** Note: Please make sure that the extension image input must correct. For example about " images " was jpg and images2 was jpeg.

Comments

Popular posts from this blog

Fixed issues:AttributeError: module 'tensorflow' has no attribute 'Session'

The previous blog, Train Custom Image Classification Model using Google Inception API was shared with you on how to train and prepare your data set. Some reader feedback that they are facing some issues with data set compilation. The issues mentioned were: AttributeError: module 'TensorFlow' has no attribute 'Session'. To fix these issues, you only need to reinstall tensorflow-gpu 1.15.0: pip3 install -- upgrade -- force - reinstall tensorflow - gpu == 1.15 . 0 more info: stack overflow hwerwerTrain Custom Image Classification Model using Google Inception API Train Custom Image Classification Model using Google Inception API

SmartSOS AI System

Abstract SmartSOS is an emergency AI handling system that works on Arduino Nano and Android mobile phones. In an emergency, the user(s) can trigger an emergency message by simply waving their hand. The emergency message (SMS) that send to related contacts consists of the user's contact number and location coordinates. Purpose Robbers and thieves can strike unexpectedly, and they can catch you off guard even if you already have an emergency plan in place. During a Robbery, you may have no time to pick up your phone to call for an emergency. Even there has some emergency app that integrates all the functionalities within one app with one action, but pickup phone and opening these apps will consume time hence will alert that the robbery's attention. SmartSOS AI System  With SmartSOS AI System, what to do during a Robbery? First, remain calm and simply raise up both hands. Then wave your hand left and right continues for more than 3sec, generally Wave Hand may likely draw the Robbe

Compile TensorFlow - Hello World

Previous tutorial was shared with you on how to setup tensorflow into your machine or PC. Now let us start test a simple tensorflow code to compile on our setup environment. 1. Open Comand Prompt on your PC. 2. Key in to conda info --envs verify tensorflow was installed on your PC. 3. Activated tensorflow , then let try to import tensorflow lib by key in import tensorflow as tf. 4. Now go to Anaconda> Sypder  editor , then key in the hello world code as below: 5. Then click to run the program, done! ** Note: You also can direct compile from Command prompt: python >>> import tensorflow as tf >>> hello = tf.constant('Hello, Tensorflow') >>> sess = tf.Session() >>> print(sess.run(hello))