Skip to main content

Posts

SmartSOS AI System

Recent posts

Convert Tensor protobuf (.pb) file to lite file via WIndows 10

In the previous tutorial, i have done the train tensor model for image classification . Here, let start to  convert Tensor protobuf (.pb)  to lite file.  This lite file is important that allows you to port this file to use on Mobile or Embedded devices. For me, convert Tensor protobuf (.pb) to lite file not as easier as a lot of tried with different converter tools and environments such as codelab, Linux, bazel etc. A lot of problems met before such as failed to compile Toco script, Android App will be crash once run with compiled lite lib. Anyway, finally, I have succeeded to convert Tensor protobuf (.pb) to lite file and able run properly on Android phones. Environment:  Asus Rog Laptop Strix G running Windows 10 Home 1. Create folder, e.g: TensorTrain_heng 2. Download Python Script below and put inside this folder, "TensorTrain_heng"      i) google_images_download.py : Link     ii) retrain.py: refer the previous tutorial 2. Open command prompt inside this fo

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

Building TensorFlow on Android Studio

Building Tensorflow on Android Station is simple. 1. Download Tensor Sample Code here:  https://github.com/tensorflow/tensorflow 2. Open Android Studio, then import ..\tensorflow\examples\android. 3. Open Build Grade, then change:' bazel ' to 'none' 4. Done. You can install built APk on your android phone and play with it! Next:  Setup Ubuntu enviroment on Windows 10 Building TensorFlow on Android Studio with  fine-tuning Inception net

Train Custom Image Classification Model using Google Inception API

The previous blog was shared with you on how to compile to use TensorFlow to classified Pre-trained images. Now I have tried to train custom images, and the results get look accurate! 1. Open Comand Prompt and then key in"git clone https://github.com/googlecodelabs/tensorflow-for-poets-2". 2. Create folder fruit inside"TensorFlow-for-poets-2\tf_files". Then create 2 different fruit folder, example: 3.  Now can download dataset by google Image durian and durian belanda, then save into the related folder, 3. Open Command Prompt inside this folder "TensorFlow-for-poets-2". 4. Then start train the data set by key in: python scripts/retrain.py --output_graph=tf_files/retrained_graph.pb --output_labels=tf_files/retrained_labels.txt --image_dir=tf_files/fruit. 5. After model train complete. Then we can start test to verify our train model. So download another Durian image then put input Image: C:\Users\csheng\tensorflow-for-poets-2\d1.jpeg

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 configurat

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))