Build a TensorFlow Image Classifier in 5 Min
In this episode we're going to train our own image classifier to detect Darth Vader images.
The code for this repository is here:
I created a Slack channel for us, sign up here:
The Challenge:
The challenge for this episode is to create your own Image Classifier that would be a useful tool for scientists. Just post a clone of this repo that includes your retrained Inception Model (label it output_graph.pb). If it's too big for GitHub, just upload it to DropBox and post the link in your GitHub README. I'm going to judge all of them and the winner gets a shoutout from me in a future video, as well as a signed copy of my book 'Decentralized Applications'.
This CodeLab by Google is super useful in learning this stuff:
This Tutorial by Google is also very useful:
This is a good informational video:
Really deep dive video on CNNs:
I love you guys! Thanks for watching my videos and if you've found any of them useful I'd love your support on Patreon:
Much more to come so please SUBSCRIBE, LIKE, and COMMENT! π
edit: Credit to Clarifai for the first conv net diagram in the video
Follow me:
Twitter:
Facebook: Instagram: Instagram:
Signup for my newsletter for exciting updates in the field of AI:
Hit the Join button above to sign up to become a member of my channel for access to exclusive content! Join my AI community: Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available):
Awesome how to!! The fact that you keep videos around 5 minutes and pack as much as you can into them shows without a doubt that you’re aware how valuable time is for thmart people. Keep it up. Your videos are going to be the model for future learning.
Thanks Nick! I’ll keep at it
You are awesomeeeee
I third this remark!
Sarcasm?
This is insane! I like that you point out how to find images so it doesn’t look like a black box image acquisition anymore. And I also like that you show it in Docker which proves the point that you can do this on Windows.
But I have questions: Do you have only Darth Vader images to train?
Can you add more classes to a pre-trained model?
If you only have Darth Vader, how can the model classifies something as a non-Vader?
I tried with 2 classes Vader and Maul images are just random selection from google image search as shown.
Accuracy is very near to 100%.
Entire setup took whole night and just now the output.
Thank you Siraj
At step 6 at 3:55 i am getting : Image directory ‘tf_files/star_wars’ not found . Tried many times in different ways ,could u please suggest a solution.
Rahul you’re the first one to post a successful completion of this!! Very cool, you get how to do this. Classify something else and post the repo to the comments, I will mention your work in a future video and send you my book for free
thanks!! you can totally add more classes. if its just one class, then it can’t classify anything as non vader, just give a likelihood percentage of how ‘vaderlike’ a given input image is. I recommend actually having 2 classes.
woooooooooooo π
Thank you Siraj.
As per my work I did not make any code change, simply put correct images per folder/label. Kept on removing unwanted images and training till better accuracy. I can post the bottleneck and inception files if those were to be put.
Is this what you are expecting? After that I have tried many things, a lot of classes all work like a charm. But not a single code change required. Also built bezel .. same output.
I think I misunderstood your challenge. π Are you expecting code change leading to near 100% accuracy? Which I did not do. π
However putting link on as soon as possible here.
I have been training for happy, smily, disgust and angry faces .. accuracy is 80%. image selection is the key here.
This is not a scientific model but it’s a fun application I made to distinguish Dragonball’s forms!
Super Saiyan Classifier:
https://github.com/off99555/Super-Saiyan-classifier
Dude!!!! Badass AF. Not the original application, but i will still link to your repo in my next video because i love this haha
Thanks for liking my work! I appreciate it a lot.
The network would try its best to output the most relevant object. In this case, it would appear to be random to us. Most of the time, the network would just output similar score for all objects if it finds several of them in the picture.
Hello sir. I need some little help. I would like to do tensorflow in real time in android. Can you give me some ideas on how to do that? Thank you very much.
mate, this is brilliant!!!
you’ve got yourself a new subscriber! I’m still a student and have an interest in machine learning (even though I haven’t tried learning it yet) this video is really amazing, hopefully I can try doing this when I have time
aweosme thanks Ralph!
Did you have time yet ?
Siraj you’re dope AF! Thanks for all these cool videos. Going to be on your channel after this midterm week following along on your videos.
This is a great way to get started with TensorFlow, asides from the big questionable Docker dependency (doesn’t work on VM’s or Windows less than 10 Pro). Getting up and running can be so hard and this makes it easier than any tutorial I’ve seen. Keep up the great work!
Hotdog or Not Hotdog?
Elrich Bachman π
JIAN JIAAAAAAAANG
hahhhaa
jajajajaja
Its a hot dog and a not a hotdog
Fyi there is a app on the appstore for the above
Hey awesome videos man. Love it how you keep it short but to the point. I was wondering if you could do a tutorial on how to lip read using our own dataset. Now that would be sooo cool.. π
Quick, easy, and fun! You gained a sub.
Excellent. And good presentation too ! Fun & smart, congrats
Hey that is the best intro ever on tensorflow. Keep making more great ones.
You lost me after Fatkunt Add-on
You’re the man Siraj, your demo works great and is easy to follow
I spend the whole day for it, and finally got it.
docker, tf, lots of image, what a amazing video. thanks Siraj Raval
God give me some strength !! Everybody is a genius
siraj my brother put the damn commands in the description lmfao
ikr
Get this working (as of August 2019):
#yes, it’s not clean, but this was done for school so it was crunch and move on
#as per video, create ~/tf_files/
#then create ~/tf_files/images & ~/tf_files/guess/
#when you pull images from google (need at least two image classes), put each differentiating directory in the ~/tf_files/images/ directory
#when you want to run the classifier, put a file named guess.jpg in the ~/tf_files/guess/ directory
#in terminal, run:
sudo docker run -it -v $HOME/tf_files:/tf_files/ tensorflow/tensorflow:latest-devel
#then run:
cd /tensorflow_src
git pull
#change to example images folder and download retrain script
cd tensorflow/examples/image_retraining
curl -O https://raw.githubusercontent.com/tensorflow/tensorflow/r1.1/tensorflow/examples/image_retraining/retrain.py
#upgrade to get tf_upgrade_v2 script
pip install –upgrade –ignore-installed tensorflow
tf_upgrade_v2
–intree .
–outtree ../image_retraining_v2
–reportfile report.txt
#change to updated retraining script and run
cd /tensorflow_src/tensorflow/examples/image_retraining_v2
python retrain.py
–bottleneck_dir=/tf_files/bottlenecks
–how_many_training_steps 500
–model_dir=/tf_files/inception
–output_graph=/tf_files/retrained_graph.pb
–output_labels=/tf_files/retrained_labels.txt
–image_dir /tf_files/images
#clone classifier repo
cd /
git clone https://github.com/llSourcell/tensorflow_image_classifier.git
#run classifier tf_files
python /tensorflow_image_classifier/src/label_image.py /tf_files/guess/guess.jpg
If you play video at 2x, you will build image classifier in 2.5 minutes
Great comment tpower16 :)))
@Vivaan Kumbhat yes, great like π What’s this ads over science? Let’s get rid of marketing when it comes real science..
This man is like how to make entire universe in 5 min. It takes time to learn and implement machine learning models. There is no point in just copy and pasting the on screen steps.