Hello, to increase performance, you can use multithreaded computing. To do this, when loading the model, specify the "num_threads" argument, which must contain the number of threads that the processor supports. Basically, TFLite uses only one core. The code: import multiprocessing tf.lite.Interpreter(model_path=PATH_TO_CKPT, num_threads=multiprocessing.cpu_count() ) On my old laptop with dual-core CPU, this gave a double increase in performance. Basic - 140 ms per frame. With two cores - 85 ms per frame
@@fe_nik_s776 you mean like this? import multiprocessing tf.lite.Interpreter(model_path=PATH_TO_CKPT, num_threads=multiprocessing.cpu_count() ) interpreter = Interpreter(model_path=modelpath)
Hey all, just a quick update (April 10 2024). I ran through the full notebook today with my coin dataset, and everything worked without errors. A "Restart Session" option appears during Step 1 after running the last set of install commands. When it appears, click the "Restart Session" option, and then keep working through the steps. If you're getting errors, try using my coin dataset and seeing if it works (it should). Then, compare your annotation files with the annotation files from the coin dataset. It's likely there's a difference in your annotation files that are causing problems.
Hello Edje, thanks for this great tutorial! While following exactly the steps in your notebook, I ran into an error repetitively when running model_builder_tf2_test.py: "Could not load dynamic library 'libcudart.so.11.0'; dlerror:.." Any idea of how to solve it?
for anyone who noticed that not all images are getting moved to its respective folders, and that later it gives some error that a file is missing: make sure all your images end with .jpg instead of .jpeg since all the scripts on the github page only takes into account those files
That was so detailed and easy process! Thank you so much for the effort you have been given for all those videos. Quick question, what if somebody wants to use rstp streams instead of raspberry or USB camera on the Raspberry Pi, what should be change and where? Thanks again.
Still is one of the best tutorial for model training in RUclips. But I have a suggestion, could there be an option to add metadata scripts to the notebook? this could be highly useful since of the release of googles ML kit for android & ios development.
its working thankyouuuuuuu edje electronics, i transfer it to raspberry pi also and it did not work at first time i just update some lib and it worked now thankyouuu thankyouuu super awsomeeee
Hello and thank you again for this tutorial! Today I was successfully able to get to the training step with my own dataset but I unfortunately forgot to turn my computer's sleep mode off. When I went to go back through the steps I keep getting an error Step 4 Cell 4 commented: "# Set file locations and get number of classes for config file". The error says "NotFoundError: /content/labelmap.pbtxt; No such file or directory" I can share a screenshot if you like. I've ran through the notebook several times and have also reset it with your most current version and I keep getting this. And in fact, there is no labelmap.pbtxt in my files. There is a labelmap.txt though! Thank you!
I ran this in a seperate cell to create the .pbtxt file: path_to_labeltxt = os.path.join(os.getcwd(), 'labelmap.txt') with open(path_to_labeltxt, 'r') as f: labels = [line.strip() for line in f.readlines()] path_to_labelpbtxt = os.path.join(os.getcwd(), 'labelmap.pbtxt') with open(path_to_labelpbtxt,'w') as f: for i, label in enumerate(labels): f.write('item { ' + ' id: %d ' % (i + 1) + ' name: \'%s\' ' % label + '} ' + ' ')
Great job man, I love the work you've done ❤ I'm a complete beginner at this, I wanted to ask if it would be possible to add to the notebook on colab a way to save progress and then continue it in another session. When I train the model I get up to 20000 steps but then I get disconnected from colab (having the free version), I was thinking if before I get disconnected I could stop the training and then later (when colab allows it again) continue it.
Hi, what I did was to replace the directories in the colab with “/mydrive/” so that everything is saved on google drive, for example instead of “!mkdir /content/images” I have “!mkdir /mydrive/images”. It is still quite risky because you are doing operations in your google drive. That's it ! I can't post my changes now because they are quite specific to my case (and I don't know if it always works), but this is how you can do it too.
Hello! Really informative video, I just wanted to know the process stays or less the same even if im on a Mac while making the project right? Is there anything I should be aware of? Furthermore its possible for me to make it so that the software detects when I am bending/bent towards the right/left and give an output, or because its the same person it wont be able to recognise that? thanks!
Thanks! It should all work inside the web browser, even if you're on a mac. However, I still haven't written the guide for how to take the downloaded model and run it on macOS. You should take a stab at it though! In fact, I'd pay you $50USD if you can write a macOS deployment guide similar to the one I wrote for Windows (github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/deploy_guides/Windows_TFLite_Guide.md). Email me if you're interested in that - info@ejtech.io ! For detecting which way you are bent, I would try using an OpenPose model (look it up on RUclips to see what I mean).
Love your tutorial!! good job with the instruction. I kind of using your material as my object detection experiment for my own dataset. But I got stuck at the training. seems like there is a version deprecation issue due to the colab upgrading TF version. I am wondering if there is an update to the code that helps at stage 5. TFLite model training :)
Thanks! Sorry, I'm not sure what's going on, and I don't have time currently to look in to it. Can you try Google searching the error to see if there's a resolution?
Hey, I was facing some issues as well. Make sure to run the session with the GPU. When I was training a larger model without the GPU, it hung on the training initialization. I also decreased the batch-size but I'm not convinced that it's actually necessary. Btw, thanks @EdjeElectronics for the tutorial, I really appreciate it!
Yeah thanks you two for replying, and can’t thank enough to @EdjeElectronic for providing the tutorial. So my issue turns out to be that my dataset contains .csv for annotation. So I had to ask GPT to write me a code to convert the labeling datasets back to .xml w/ exactly the same format as the dataset you provide for the coin dataset. I did it offline with Jupyter Notebook and re-upload them back to Gdrive and continue using your code to train, and after 2 weeks of tweaking, I finally made it to train with your magical instruction:) I looked into every line of your code and went down the rabbit hole with even the extension .py you linked and trying to study the logic behind the code w/ the help of chatGPT :D Long story short, I got it to train and it’s training. Yay!!!
Ok so i figured it out. I realize that the entire process requires xml and image dataset. i had csv and image as my dataset. So i converted the csv labeling dataset back into xml format locally and re upload the dataset and run the code and worked!! yay~✌😇
Good afternoon, great contribution that you really make, congratulations, a question when doing the training is paralyzed and does not continue on API in Colab, what could happen?
Sorry, I haven't encountered that problem before. My guess is to restart the Colab from scratch and try to run through it again. Otherwise, I'm not sure how to solve it.
Great tutorial!! Great introductory experience while also providing everything needed for learning rabbit holes. If you come across Step 5 ending with ^c, it is because you are running out of memory. Either resize your images to be large/medium (~200-300KB per image), upload less images, or both.
Nice and clear step-by-step video! However, I cannot run it smoothly at my side. At section3.3, no labelmap.pbtxt is generated so the later step in section 4 crash. Would you know the reason ?
@EdjeElectronics, I had a bug whereby on step 5, the training stops about a minute :( I practically did everything according to the tutorial. The code ends with a ^C symbol. Also, I noticed that the system RAM skyrocketed to 12.1Gb before the training process stopped... Could this be the issue? I would be really grateful if you could provide me some guidance please.
Your images are too large and you're running out of memory. Resize them to be around 200-300KB, don't upload too many images, and you should be good to go
Great tutorial! I've been encountering a problem though with my dataset. All file names are correct, also the file extensions, and have tried all options of adding a dataset (upload, gdrive mounting, dropbox) I even checked the csv file and all are intact. However, when its time to create the tfrecord files, there appear to be some files missing in both the train and validation folders, thus I can't generate the pbtxt file. Any tips?
Thank you! Hmm, usually if there's an issue with the pbtxt file, it's because there's a problem with the annotation data (like a typo in a class name). Can you try using my coin dataset and see if you get the same issue?
Really good tutorial, I am following along for my school project, I can get as far as to the training, then it won't start training in Colab, in the log, it shows that the TensorFlow Addons needs tf version 2.12 - 2.15.0, would that be the case? I can see your video using python 3.8, currently the colab is run on python 3.10, could that be the reason? Could you please help? Thank you
I wrote an auto-annotation script that labels images using early versions of the model. I trained a model off 200 manually labeled images, then used that model to label the remaining images and fixed any errors. It worked pretty well! Hoping to make a video about it in the next few months. But you can check out the code I used here: github.com/EdjeElectronics/Image-Dataset-Tools#autolabeler
@@EdjeElectronics excellent work, thanks for sharing the repository, I am looking to create a model that will make it easier for me to detect the barcodes of some products on a supermarket shelf
@@EdjeElectronics There are a few persistent warnings in the notebook now because of which it does not run anymore. Kindly check the comment sections and reply. The training does not commence in step 5. It worked once when we tried the notebook on a smaller dataset but then now we are trying to deploy the full dataset it shows this issue and does not run.
Thank You for your tutorial, it has been of great help to me but, I when upload the images folder and run it to distribute data for training, validation and test it show me zero images in total Please guide me in this regard
Many thanks for the good video and the excellent Google Colab script. But when I want to use the T100 CPU (Batch 64) in Colab, problems occur. It then takes a very long time before the training starts and the output in the tensor board is relatively senseless. (Only flat graphs). Maybe you would like to check the code, because a lot has changed in the packages. (Unfortunately, I can't, because my detailed knowledge is not yet good enough). Thank you very much for your efforts. Best regards, Michael
Hello @Edje Electronics Thank you for this amazing project, I must i has really been helpful and a life saver. I have question though. Is there like a script that i can use to resume training assuming i have the model saved in directory that is not temporary? Thank You in anticipation
@@EdjeElectronics Thank you for your response. Yes i figured it out. Also, do you have a video for how to auto launch the python scripts at boot on the raspberry pi, that i don't have to login to the desktop environment before starting my script? Thank you.
hello sir can you tell me how did you resume the training? I am having a really big trouble training my dataset since I have 6452 images on my dataset and I was training it for 40k steps just to have atleast good accuracy but it always get timeout before it even done training into 30k steps I wonder how did you make to resume it I really appreciate hope you share it
Hi! I'm getting an error when training a custom model (Train Custom TFLite Detection Model) and a warning: TensorFlow Addons (TFA) has ended development and introduction of new features. TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024. Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP).
Hello! Thanks for the tutorial. It really helped a lot. But, I'd like to ask, besides the mAP evaluation metrics, how do I include other metrics such as Kappa, F1, confusion matrix, etc in order to provide more information about the model. Thanks!
Really thank you very much for the tutorial I was able to do the inference on a Raspberry Pi. However, just after the entire model I evaluated the precision of the model on the training and test data but the script that I I wrote to myself about errors since the images were saved in tfrecord format. Could I have a hand lesson?
Thanks for the great content. I have some doubts, the video displaying is running at 2.7 FPS with Raspberry Pi, with you it reaches about 5 FPS, why my one is slower?
Hey bro, were you able to complete the custom object detection... I had an issue during the training process whereby it will stop after 50s. Usually it should take several hours. I also noticed that my system Ram reached about 12.1Gb before it stopped... did yours do the same? I would be really grateful for some guidance...
if you do everything right and it stuck on "use tf.cast instead" without any error. The problem is your train.tfrecord is empty. you need to change your xml files to make it work. it should look like this without any extra rows or parameters. Dont worry only important thing in this code is object name, min/max values and filename. If you have any additional row in your xml just manually delete it or use different label tool datasetjpg 20.jpg C:\Users\Kaan PC\Desktop\datasetjpg\20.jpg Unknown
@@EdjeElectronics I want to train my own model and there is only one class for example car. Just one. But section 3.3 doesn't accept it. And it give a error masege " penny, nickel, dime, quarter use " like this. What should ı do?
Thanks, I appreciate you saying that! It helps motivate me to make more videos 😀. I have been busy working on paid projects, but I really want to do a video series on creating applications with YOLOv8. I don't know when I'll get to it though.
Hello! Awesome video btw! I tried to create my own model but i start to run training block, this error shows: TensorFlow Addons (TFA) has ended development and introduction of new features. TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024. Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP). any help with this? Really appreciate it!!
Excellent video. I have a query regarding the application of the model. If, for example, I require that the detected elements be registered, what script would you recommend I use to do this? Thanks.
Do you need to upgrade to Colab Pro for 100 compute units to complete the training? I trained for 1.5 hours but I did not see any progress on the Tensor Dashboard. My dataset consists of 200 images with objects labelled and XML files and only one class object, I used the default "ssd-mobilenet-v2-fpnlite-320" tensor model with a batch size is 16 images and num steps is 40,000 steps. I left my dataset training overnight, but it timed out. Now I have 0 compute unit so I can not connect to the backend GPU. Google does not see when I will get free compute unit again but suggested that I either upgrade to Colab Pro or Google Cloud Platform marketplace.
Any chance you can update the instructions to show how to convert the model to tensorflow.js? I've followed the video and it all worked but running the model through tensorflowjs_converter results in a 16kb .bin file which is obviously not correct. Fantastic tutorial - thanks!!
That'd be awesome. Thanks@@EdjeElectronics. Here's the docs that I've read - I "think" that your tutorial creates a "shared model" and then you convert from that but I might be wrong
Great Video! I used this to train a custom model to detect bricks for a brick laying machine. The only issue I have is getting it to work with a pi HQ camera like the one your using. It works with a USB webcam but I get an error "can't open camera by index" when I try with the pi HQ camera. Is there an additional step to make this compatible with that camera?
Thanks, that sounds like an awesome project! I think it might be a driver compatibility issue with the Picamera. They released new drivers a couple years ago, and I have had to use "legacy mode" to get them to work. Try following the steps in the first section on this page and see if it helps: projects.raspberrypi.org/en/projects/getting-started-with-picamera
Thanks for the video!!. I have some doubts, if I would train a model for detecting no ok parts, the way you showed us will fit for my model?, Must I take a picture for any defect and label it? Must take pictures for ok parts and label it also?. I'm trying to detect defects like scratches, marks, paint defects, etc...any help will be much appreciated!!
No fucking way u are givin us for free this kind of information, i love u so much, i have spend the last 2 months trying do a tensorFlow Object Detecion works, u deserve the best things of world can provide thanks thanks thankssssssssssssssssssssssssssssssss
Great tutorial! I have a question though. Do I need to pre process my images to become accurate or no need? I've been training my model for a weeks and I already have a 1000+ datasets but some of the datasets are not accurate. Help please.
I had a doubt by the way. 1) What was the reason you've used the tensorflow 2.8 model. Is it like only due to compatibilty issue in Colab. 2)Could i run the same code in my local PC, if yes then how should i Install the CUDA Libs I have and RTX 4060 Gpu. So could I run the code normally depending upon the latest version of tensorflow Please help me out with this Thank you...
Is it possible to use a trained model to run object detection in real-time using my laptop’s camera on a Mac? I need help setting up a program that can detect specific objects from my trained dataset using TensorFlow Lite. Could you guide me through the process?
First of all, thank you very much for the great work. I have a question for you. I can't convert tensorflow lite version to tensor flow js how should I write a code block about it
Great tutorial! I have just one question. I would like to use my model with opencv and use the x,y,h,w of the targeted object for other stuff.. is there an easy way to do that?
hello, I have a question. I bought an edge tpu coral for more camera fps, I also used the file that downloaded in the final part which is for edge tpu. It works but it cannot easily detect objects when the coral is plugged in, but if the edge tpu is disconnected, it runs at 2 fps but it always detect the object. May I know if there’s a fix on this one? Thank you!
Hello, can we have a tutorial about implementing the tensorflow lite model that is made in this video to a mobile object detection application. Thank you very much and looking forward to it
i am also got this problem. I think we have this problem because memory was not enough. You can checked your dataset, especially size archive your dataset! If this workout, please response there
Hello, friend!! Many thanks for this utterly useful video. I use trained model in Home Assistant addon DOODS and can't deal with error: AttributeError: 'TensorflowLite' object has no attribute 'input_data''` What do you think what i need to change in google colab sequencing in order to solve this issue?
Hello! I've been meaning to ask if you have a tutorial for deploying this to android yet? Im currently trying to make it work on the TFLite demo app but I've only been able to deploy ssd mobilenet models trained in tflite 1.15. Any thoughts?
Hey, good timing! Can you try out this guide and let me know if you're able to get it working? I'm about to merge it into my repository. github.com/MkWf/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/deploy_guides/Android_TFLite_Guide.md
Hi! I’m on the last step of the process I use pi camera v3 for my camera I do not know what’s causing this but the frame=frame1.copy says that Error:’NoneType’ object has no attribute ‘copy’. What can I do to fix this?
great tutorial thanks, can you explain how to use the TF lite model in real-time detection using a webcam and how to deploy the model on a mobile application
Awesome vid! But it didn't work. Keep getting a ^c when I tried to run my training. SO each time I reflashed the window, it just showed 3 pictures from my training folder?
Waow, thanks for your quick response sir! Hmm, yes turn out to work just fine with your dataset. I followed the video quite close, and I can´t really see the issue? I was uploading from google Drive? @@EdjeElectronics
@Edje Electronics - I can see now, that after I ran your 3.2 split images into test, validation, and train folders. My test folder is empty, and the same goes for my validations folder. My train folder holds now 11 pictures? In the folder with all images, I have 184 images for .jpg and 184 for XML. So it seems like there is an issue with the script.
Is there any advice with big dataset? it will took more than 2 hours which will consume GPU usage and in the end it will cause google colab to stop due to GPU limit
I am using your card images in your tensorflow 1 on Windows 10 to train on mediapipe-model-maker. I got the model.tflite in floating point format. The training take less than 10 minutes and the result seems to be acceptable when I am using in my Raspberry Pi4. However, I only get around 2.5 fps. I wonder if the model is compatible with your tflite model. Do you know how to convert it to edge tpu format?
Hi, I have encountered a problam everything works fine until i get to Start training a model. It displays log text but after about 3 minutes RAM usage go to max and script just exit. Please HELP!! i have this for a school project and I'm running out of time. Thanks
Yes - copy the last checkpoint files (2 files with same number) under "training" and the index file. When starting again, create the training directory manually and copy the files into the directory before you start training again. This worked for me. It just picks up from where it left off and you can see the loss continuing downward trend :D
It would be interesting if you will try same model on OrangePi 5/RockPi 5B that have NPU or Orange Pi AI USB Stick. Coral and Intel USB sticks are not available right now.
I just got my OrangePi 5 in the mail! Pretty excited to use it. I'm going to post a benchmarking video in the next month or two. You're right, though, Coral USB Accelerators are hard to get a hold of (and production of the Intel NCS2 has been cancelled).
The best tutorial in the world! :) Please could you modify the code on Google Colab in the future so that training also works for negative images and xml files without objects in them? Now it gives errors. Thank you so much, we love you!
Hello, I would want to ask you if there is a way for the model to be able to detect more than 10 objects from a single cloud. I am trying to make a cloud detection algorithm using a Raspberry Pi 4 and a Coral TPU. For that I need the model to be able to detect more than 10 clouds. Is it possible to do with your code? If so, what do I need to change in the config?
I noticed the 10 object limitation too. I'm still trying to figure out how to change that in the config. For now, you can use TFLite Model Maker to train an EffiicientDet-Lite model, those ones are able to detect more than 10 objects. www.tensorflow.org/lite/models/modify/model_maker/object_detection
Ive been banging my head on my desk trying to find a good tutorial. Big thank
Hello, to increase performance, you can use multithreaded computing. To do this, when loading the model, specify the "num_threads" argument, which must contain the number of threads that the processor supports. Basically, TFLite uses only one core.
The code:
import multiprocessing
tf.lite.Interpreter(model_path=PATH_TO_CKPT, num_threads=multiprocessing.cpu_count() )
On my old laptop with dual-core CPU, this gave a double increase in performance.
Basic - 140 ms per frame.
With two cores - 85 ms per frame
Thanks, I'll have to try that!
This works like a charm bro! On a pi 4, My fps went from 8fps to 20fps when using the google sample tflite model!🤯
@@khamismuniru5188 how
@@SumitXD123 Section 7.1. In the line -> interpreter = Interpreter(model_path=modelpath)
@@fe_nik_s776 you mean like this?
import multiprocessing
tf.lite.Interpreter(model_path=PATH_TO_CKPT, num_threads=multiprocessing.cpu_count() )
interpreter = Interpreter(model_path=modelpath)
Hey all, just a quick update (April 10 2024). I ran through the full notebook today with my coin dataset, and everything worked without errors. A "Restart Session" option appears during Step 1 after running the last set of install commands. When it appears, click the "Restart Session" option, and then keep working through the steps. If you're getting errors, try using my coin dataset and seeing if it works (it should). Then, compare your annotation files with the annotation files from the coin dataset. It's likely there's a difference in your annotation files that are causing problems.
Hello Edje, thanks for this great tutorial! While following exactly the steps in your notebook, I ran into an error repetitively when running model_builder_tf2_test.py: "Could not load dynamic library 'libcudart.so.11.0'; dlerror:.." Any idea of how to solve it?
for anyone who noticed that not all images are getting moved to its respective folders, and that later it gives some error that a file is missing: make sure all your images end with .jpg instead of .jpeg since all the scripts on the github page only takes into account those files
That was so detailed and easy process! Thank you so much for the effort you have been given for all those videos. Quick question, what if somebody wants to use rstp streams instead of raspberry or USB camera on the Raspberry Pi, what should be change and where? Thanks again.
Still is one of the best tutorial for model training in RUclips. But I have a suggestion, could there be an option to add metadata scripts to the notebook? this could be highly useful since of the release of googles ML kit for android & ios development.
Thanks! I'm not sure what you mean by "metadata scripts", could you please provide some more description?
Thank you for a wonderful breakdown of all the needed steps to do training on colab ❤❤❤ Your follower from Egypt 🥰
Amazing tutorial! One of the most useful videos I've ever watched. Keep up the good work!
Thanks a lot, Edje!
I struggle a week trying the repo from Google and this video save my life thank you I would like to see a video of posenet in Raspberry Pi
is your tflite model detecting items well? because my model detecting false products
@@shivarajchangale47 yes but i mean when i tried to run It in a new OS from Raspberry PI
its working thankyouuuuuuu edje electronics, i transfer it to raspberry pi also and it did not work at first time i just update some lib and it worked now thankyouuu thankyouuu super awsomeeee
Hello and thank you again for this tutorial!
Today I was successfully able to get to the training step with my own dataset but I unfortunately forgot to turn my computer's sleep mode off. When I went to go back through the steps I keep getting an error Step 4 Cell 4 commented: "# Set file locations and get number of classes for config file". The error says "NotFoundError: /content/labelmap.pbtxt; No such file or directory" I can share a screenshot if you like. I've ran through the notebook several times and have also reset it with your most current version and I keep getting this. And in fact, there is no labelmap.pbtxt in my files. There is a labelmap.txt though!
Thank you!
yeah, the .pbtxt does not get created in my case either.
I ran this in a seperate cell to create the .pbtxt file:
path_to_labeltxt = os.path.join(os.getcwd(), 'labelmap.txt')
with open(path_to_labeltxt, 'r') as f:
labels = [line.strip() for line in f.readlines()]
path_to_labelpbtxt = os.path.join(os.getcwd(), 'labelmap.pbtxt')
with open(path_to_labelpbtxt,'w') as f:
for i, label in enumerate(labels):
f.write('item {
' +
' id: %d
' % (i + 1) +
' name: \'%s\'
' % label +
'}
' +
'
')
have you fix this problem yet?
Really nice video. Anxiously waiting for an Android deploying tutorial!
Great job man, I love the work you've done ❤
I'm a complete beginner at this, I wanted to ask if it would be possible to add to the notebook on colab a way to save progress and then continue it in another session.
When I train the model I get up to 20000 steps but then I get disconnected from colab (having the free version), I was thinking if before I get disconnected I could stop the training and then later (when colab allows it again) continue it.
Nevernind i solved this, for everyone interested i chnaged pretty much all of the paths to save on google drive.
hello! would you mind if i can ask how to be able to save paths on gdrive ? thanks a lot
Hi, what I did was to replace the directories in the colab with “/mydrive/” so that everything is saved on google drive, for example instead of “!mkdir /content/images” I have “!mkdir /mydrive/images”. It is still quite risky because you are doing operations in your google drive. That's it !
I can't post my changes now because they are quite specific to my case (and I don't know if it always works), but this is how you can do it too.
@@0oMardev i hope you still can read my comment man, thanks for your tips but can you still provide more info? Thank youuu
@@0oMardev so when you continue to train it again, you just have to mount your gdrive and run the "Train" again?
Thankyou so much you made my day, I was searching all internet for working colab notebook for this model.
Really excited your back! Thanks for the video.
Hello! Really informative video, I just wanted to know the process stays or less the same even if im on a Mac while making the project right? Is there anything I should be aware of?
Furthermore its possible for me to make it so that the software detects when I am bending/bent towards the right/left and give an output, or because its the same person it wont be able to recognise that?
thanks!
Thanks! It should all work inside the web browser, even if you're on a mac. However, I still haven't written the guide for how to take the downloaded model and run it on macOS. You should take a stab at it though! In fact, I'd pay you $50USD if you can write a macOS deployment guide similar to the one I wrote for Windows (github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/deploy_guides/Windows_TFLite_Guide.md). Email me if you're interested in that - info@ejtech.io !
For detecting which way you are bent, I would try using an OpenPose model (look it up on RUclips to see what I mean).
Love your tutorial!! good job with the instruction. I kind of using your material as my object detection experiment for my own dataset. But I got stuck at the training. seems like there is a version deprecation issue due to the colab upgrading TF version. I am wondering if there is an update to the code that helps at stage 5. TFLite model training :)
Thanks! Sorry, I'm not sure what's going on, and I don't have time currently to look in to it. Can you try Google searching the error to see if there's a resolution?
Hey, I was facing some issues as well. Make sure to run the session with the GPU. When I was training a larger model without the GPU, it hung on the training initialization. I also decreased the batch-size but I'm not convinced that it's actually necessary. Btw, thanks @EdjeElectronics for the tutorial, I really appreciate it!
Yeah thanks you two for replying, and can’t thank enough to @EdjeElectronic for providing the tutorial. So my issue turns out to be that my dataset contains .csv for annotation. So I had to ask GPT to write me a code to convert the labeling datasets back to .xml w/ exactly the same format as the dataset you provide for the coin dataset. I did it offline with Jupyter Notebook and re-upload them back to Gdrive and continue using your code to train, and after 2 weeks of tweaking, I finally made it to train with your magical instruction:)
I looked into every line of your code and went down the rabbit hole with even the extension .py you linked and trying to study the logic behind the code w/ the help of chatGPT :D
Long story short, I got it to train and it’s training. Yay!!!
Ok so i figured it out. I realize that the entire process requires xml and image dataset. i had csv and image as my dataset. So i converted the csv labeling dataset back into xml format locally and re upload the dataset and run the code and worked!! yay~✌😇
@@PeterPan-hs5tu Awesome, glad you were able to figure it out!
Superb..It is hard to install tensorflow api because the version incompatibilities..you handle those superbly
Good afternoon, great contribution that you really make, congratulations, a question when doing the training is paralyzed and does not continue on API in Colab, what could happen?
Sorry, I haven't encountered that problem before. My guess is to restart the Colab from scratch and try to run through it again. Otherwise, I'm not sure how to solve it.
Your tutorial is the best on the internet. Exactly what I needed! Thank you! Thank you! Thank you!!!
Great tutorial!! Great introductory experience while also providing everything needed for learning rabbit holes.
If you come across Step 5 ending with ^c, it is because you are running out of memory. Either resize your images to be large/medium (~200-300KB per image), upload less images, or both.
wow thanks man!
Thank you for a wonderful breakdown of all the needed steps to do training on colab.
Nice and clear step-by-step video!
However, I cannot run it smoothly at my side.
At section3.3, no labelmap.pbtxt is generated so the later step in section 4 crash. Would you know the reason ?
Yes for me too got any fix?
@@260.vighneshbablu2 it suddenly fixed after i reload the notebook and redo all the steps
@@260.vighneshbablu2 guess another solusion can be finding one .pbtxt, follow its formet and edit according to your custom class names.
@@humilam4808 but the format is not shown in the video
@@260.vighneshbablu2 find one online
@EdjeElectronics,
I had a bug whereby on step 5, the training stops about a minute :( I practically did everything according to the tutorial. The code ends with a ^C symbol. Also, I noticed that the system RAM skyrocketed to 12.1Gb before the training process stopped... Could this be the issue? I would be really grateful if you could provide me some guidance please.
i have the same issue ! I'm pretty much sure this is beacause of the ram capabilities... I gess we have to subscibe to googlecolab pro
Your images are too large and you're running out of memory. Resize them to be around 200-300KB, don't upload too many images, and you should be good to go
Great tutorial! I've been encountering a problem though with my dataset. All file names are correct, also the file extensions, and have tried all options of adding a dataset (upload, gdrive mounting, dropbox) I even checked the csv file and all are intact. However, when its time to create the tfrecord files, there appear to be some files missing in both the train and validation folders, thus I can't generate the pbtxt file. Any tips?
Thank you! Hmm, usually if there's an issue with the pbtxt file, it's because there's a problem with the annotation data (like a typo in a class name). Can you try using my coin dataset and see if you get the same issue?
Really good tutorial, I am following along for my school project, I can get as far as to the training, then it won't start training in Colab, in the log, it shows that the TensorFlow Addons needs tf version 2.12 - 2.15.0, would that be the case? I can see your video using python 3.8, currently the colab is run on python 3.10, could that be the reason? Could you please help? Thank you
Really detailed. A query though, where in the above procedures should I rectify to train a face detection model??
Thanks!, Did you label them one by one or did you use any tool or script?
I wrote an auto-annotation script that labels images using early versions of the model. I trained a model off 200 manually labeled images, then used that model to label the remaining images and fixed any errors. It worked pretty well! Hoping to make a video about it in the next few months. But you can check out the code I used here:
github.com/EdjeElectronics/Image-Dataset-Tools#autolabeler
@@EdjeElectronics excellent work, thanks for sharing the repository, I am looking to create a model that will make it easier for me to detect the barcodes of some products on a supermarket shelf
Thankkk youu sooo much for the tutorial, I've been researching on the internet but didn't get the solution. Great work you've earned a subscriber.
This tutorial was super helpful, thank you a lot! It is very easy to follow along and understand with step-by-step instructions
Thank you! Clear and easy to understand while having sprinkles of humor made this video really educational AND enjoyable. Easiest like and subscribe.
Thanks for the kind words! 😸
@@EdjeElectronics There are a few persistent warnings in the notebook now because of which it does not run anymore. Kindly check the comment sections and reply. The training does not commence in step 5. It worked once when we tried the notebook on a smaller dataset but then now we are trying to deploy the full dataset it shows this issue and does not run.
Thank You for your tutorial, it has been of great help to me but, I when upload the images folder and run it to distribute data for training, validation and test it show me zero images in total
Please guide me in this regard
Many thanks for the good video and the excellent Google Colab script.
But when I want to use the T100 CPU (Batch 64) in Colab, problems occur. It then takes a very long time before the training starts and the output in the tensor board is relatively senseless. (Only flat graphs).
Maybe you would like to check the code, because a lot has changed in the packages. (Unfortunately, I can't, because my detailed knowledge is not yet good enough).
Thank you very much for your efforts.
Best regards, Michael
Hello @Edje Electronics Thank you for this amazing project, I must i has really been helpful and a life saver. I have question though. Is there like a script that i can use to resume training assuming i have the model saved in directory that is not temporary? Thank You in anticipation
Hi Abraham, yes, there should be a way to do that, but I don't have time to remember it right now. Hope you can figure it out!
@@EdjeElectronics Thank you for your response. Yes i figured it out.
Also, do you have a video for how to auto launch the python scripts at boot on the raspberry pi, that i don't have to login to the desktop environment before starting my script? Thank you.
hello sir can you tell me how did you resume the training? I am having a really big trouble training my dataset since I have 6452 images on my dataset and I was training it for 40k steps just to have atleast good accuracy but it always get timeout before it even done training into 30k steps I wonder how did you make to resume it I really appreciate hope you share it
Hello, this video is amazing, but do you know how this trained model work on ESP32 CAM?
Really amazing video with detailed and well-explained steps. Great job!
thank you so much for uploading this video. Helped a lot!
:D
Good to see you again!
Thanks! I'm going to try and hold myself to a more regular release schedule now... we'll see how it goes! 😁
Helpful video. can i peform segmentation instead of object detection in tensorflow lite?
Amazing work, but I noticed that the camera is very slow when you launch the test. Can you please tell me why? Thanks
Hi! I'm getting an error when training a custom model (Train Custom TFLite Detection Model) and a warning:
TensorFlow Addons (TFA) has ended development and introduction of new features. TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024. Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP).
Hello! Thanks for the tutorial. It really helped a lot. But, I'd like to ask, besides the mAP evaluation metrics, how do I include other metrics such as Kappa, F1, confusion matrix, etc in order to provide more information about the model.
Thanks!
i need to
kkkkk
Really thank you very much for the tutorial I was able to do the inference on a Raspberry Pi. However, just after the entire model I evaluated the precision of the model on the training and test data but the script that I I wrote to myself about errors since the images were saved in tfrecord format. Could I have a hand lesson?
Thanks for the great content. I have some doubts, the video displaying is running at 2.7 FPS with Raspberry Pi, with you it reaches about 5 FPS, why my one is slower?
Hey bro, were you able to complete the custom object detection... I had an issue during the training process whereby it will stop after 50s. Usually it should take several hours. I also noticed that my system Ram reached about 12.1Gb before it stopped... did yours do the same? I would be really grateful for some guidance...
Hi did you figure it out...can you share your experience?@@PraiseTheLord527
Amazing!! Incredible to see you using the model on another device.
if you do everything right and it stuck on "use tf.cast instead" without any error. The problem is your train.tfrecord is empty. you need to change your xml files to make it work. it should look like this without any extra rows or parameters. Dont worry only important thing in this code is object name, min/max values and filename. If you have any additional row in your xml just manually delete it or use different label tool
datasetjpg
20.jpg
C:\Users\Kaan PC\Desktop\datasetjpg\20.jpg
Unknown
1920
1080
3
0
car
Unspecified
0
0
1205
38
1900
387
Thanks for posting this solution!
@@EdjeElectronics I want to train my own model and there is only one class for example car. Just one. But section 3.3 doesn't accept it. And it give a error masege " penny, nickel, dime, quarter use " like this. What should ı do?
I did this but it's still stuck in there? What else can be the solution?
hey, when next video about object detection fine tuning and creating apps with that? really love your videos
Thanks, I appreciate you saying that! It helps motivate me to make more videos 😀. I have been busy working on paid projects, but I really want to do a video series on creating applications with YOLOv8. I don't know when I'll get to it though.
Thanks for the tutorial. I noticed the image detection draws a maximum of 10 objects is there a way to increase the count?
hey mate! Did you manage to solve it?
I'm having the same issue.
Hello! Awesome video btw! I tried to create my own model but i start to run training block, this error shows:
TensorFlow Addons (TFA) has ended development and introduction of new features.
TFA has entered a minimal maintenance and release mode until a planned end of life in May 2024.
Please modify downstream libraries to take dependencies from other repositories in our TensorFlow community (e.g. Keras, Keras-CV, and Keras-NLP).
any help with this? Really appreciate it!!
same problem pls help.
Excellent video. I have a query regarding the application of the model. If, for example, I require that the detected elements be registered, what script would you recommend I use to do this? Thanks.
Hi wonderful video, I'm working on a custom dataset with more than 4 classes what file or code would I change?
Thanks for making this amazing video! It is really helpful. Look forward to the "quantize TFLite model:" video too!!!
Thank you for the tutorial video! And I have a question how can I export the classification output data and save in the txt file?
Do you need to upgrade to Colab Pro for 100 compute units to complete the training? I trained for 1.5 hours but I did not see any progress on the Tensor Dashboard. My dataset consists of 200 images with objects labelled and XML files and only one class object, I used the default "ssd-mobilenet-v2-fpnlite-320" tensor model with a batch size is 16 images and num steps is 40,000 steps. I left my dataset training overnight, but it timed out. Now I have 0 compute unit so I can not connect to the backend GPU. Google does not see when I will get free compute unit again but suggested that I either upgrade to Colab Pro or Google Cloud Platform marketplace.
Any chance you can update the instructions to show how to convert the model to tensorflow.js? I've followed the video and it all worked but running the model through tensorflowjs_converter results in a 16kb .bin file which is obviously not correct. Fantastic tutorial - thanks!!
I can look into it! Do you know where in the TensorFlow docs I can find more info about tensorflowjs_converter?
That'd be awesome. Thanks@@EdjeElectronics. Here's the docs that I've read - I "think" that your tutorial creates a "shared model" and then you convert from that but I might be wrong
@@mortocks Hi! Did you find a solution? can you help me, i need in .js too
Great Video! I used this to train a custom model to detect bricks for a brick laying machine. The only issue I have is getting it to work with a pi HQ camera like the one your using. It works with a USB webcam but I get an error "can't open camera by index" when I try with the pi HQ camera. Is there an additional step to make this compatible with that camera?
Thanks, that sounds like an awesome project! I think it might be a driver compatibility issue with the Picamera. They released new drivers a couple years ago, and I have had to use "legacy mode" to get them to work. Try following the steps in the first section on this page and see if it helps:
projects.raspberrypi.org/en/projects/getting-started-with-picamera
@@EdjeElectronics That worked! Thanks!
Hello, first thank you for sharing your workflow with us. How can I get the detected objected (as text) scripted when i run the model?
Any tips?
Thanks for the video!!. I have some doubts, if I would train a model for detecting no ok parts, the way you showed us will fit for my model?, Must I take a picture for any defect and label it? Must take pictures for ok parts and label it also?. I'm trying to detect defects like scratches, marks, paint defects, etc...any help will be much appreciated!!
No fucking way u are givin us for free this kind of information, i love u so much, i have spend the last 2 months trying do a tensorFlow Object Detecion works, u deserve the best things of world can provide thanks thanks thankssssssssssssssssssssssssssssssss
Great tutorial! I have a question though. Do I need to pre process my images to become accurate or no need? I've been training my model for a weeks and I already have a 1000+ datasets but some of the datasets are not accurate. Help please.
I had a doubt by the way.
1) What was the reason you've used the tensorflow 2.8 model. Is it like only due to compatibilty issue in Colab.
2)Could i run the same code in my local PC, if yes then how should i Install the CUDA Libs I have and RTX 4060 Gpu. So could I run the code normally depending upon the latest version of tensorflow
Please help me out with this
Thank you...
Thank you. Very nice guide for beginner. Please do video for audio classification using microphone with raspberry pi.
Is it possible to use a trained model to run object detection in real-time using my laptop’s camera on a Mac? I need help setting up a program that can detect specific objects from my trained dataset using TensorFlow Lite. Could you guide me through the process?
Thankyou somuch for your helping with this video, now can implement this tutorial in my final task
Thank you soo much.. i just trained model on coral usb
First of all, thank you very much for the great work. I have a question for you. I can't convert tensorflow lite version to tensor flow js how should I write a code block about it
Great tutorial!
I have just one question.
I would like to use my model with opencv and use the x,y,h,w of the targeted object for other stuff..
is there an easy way to do that?
did you ever figure this out? I am doing the same
hello, I have a question. I bought an edge tpu coral for more camera fps, I also used the file that downloaded in the final part which is for edge tpu. It works but it cannot easily detect objects when the coral is plugged in, but if the edge tpu is disconnected, it runs at 2 fps but it always detect the object. May I know if there’s a fix on this one? Thank you!
Hello Remus!
Just wondering if you were able to solve this issue? :O
Its great 👍
Please tell me about Python. It installed on your Raspberry pi?
Hello, can we have a tutorial about implementing the tensorflow lite model that is made in this video to a mobile object detection application. Thank you very much and looking forward to it
Can you do this with screenshots from a website to train it to identify certain images on a website?
i unable to make labelmap.pbtxt on step 3.3, how do i fix this?
same problem
@@roeyasher1396 i can't paste here the raw code..sorry
@@rmmtech1218 please let us know what to be done or can you drop same to mail id?
Drop your mail id, I will send pdtxt file, you have to change classes there and paste at location
thank you broo, you're amazing💣
Why does my learning process end just before the beginning of the analysis of images with "^C" in the last line?
i am also got this problem. I think we have this problem because memory was not enough. You can checked your dataset, especially size archive your dataset! If this workout, please response there
Hello, friend!! Many thanks for this utterly useful video. I use trained model in Home Assistant addon DOODS and can't deal with error: AttributeError: 'TensorflowLite' object has no attribute 'input_data''`
What do you think what i need to change in google colab sequencing in order to solve this issue?
Thanks for the helpful tutorial, but I want to make an inference on the esp32 cam, can you provide a solution?
Can we train for image segmentation model too with this codelab?
So everything works great! Just wondering how to use it with Coral USB accelerator? Tried to run same code with -edge tpu
Hey there. I am facing issues with training part. It showing dependencies issues with keras and tensorflow. Could you please help me with this problem
Hello! I've been meaning to ask if you have a tutorial for deploying this to android yet? Im currently trying to make it work on the TFLite demo app but I've only been able to deploy ssd mobilenet models trained in tflite 1.15. Any thoughts?
Hey, good timing! Can you try out this guide and let me know if you're able to get it working? I'm about to merge it into my repository. github.com/MkWf/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/deploy_guides/Android_TFLite_Guide.md
Hi! I’m on the last step of the process I use pi camera v3 for my camera I do not know what’s causing this but the frame=frame1.copy says that Error:’NoneType’ object has no attribute ‘copy’. What can I do to fix this?
great tutorial thanks, can you explain how to use the TF lite model in real-time detection using a webcam and how to deploy the model on a mobile application
Great tutorial. Anybody else having an issue with getting more than 10 detections of the same class per image?
Awesome vid! But it didn't work. Keep getting a ^c when I tried to run my training. SO each time I reflashed the window, it just showed 3 pictures from my training folder?
I've seen that happen sometimes when there's problems with the training data. Can you try it with my coin dataset and see if you get the same issue?
Waow, thanks for your quick response sir! Hmm, yes turn out to work just fine with your dataset. I followed the video quite close, and I can´t really see the issue? I was uploading from google Drive? @@EdjeElectronics
@Edje Electronics - I can see now, that after I ran your 3.2 split images into test, validation, and train folders. My test folder is empty, and the same goes for my validations folder. My train folder holds now 11 pictures? In the folder with all images, I have 184 images for .jpg and 184 for XML. So it seems like there is an issue with the script.
The ^C could be coming from a RAM overload. If thats the case, reduce your image sizes.
@@jako3939 Do you have any suggestion to reduce quickly the size of the images without relabeling the images?
Is there any advice with big dataset? it will took more than 2 hours which will consume GPU usage and in the end it will cause google colab to stop due to GPU limit
I did face the same issue! Do you had resolve the issue?
LIFE SAVER MAN THANKS
Why does the model only detect one class during the testing process even though the dataset has three classes?
hello good sir, this is a very helpful vid. Currently waiting for the how to capture and label training data video
It will be out on Monday! Just finishing up the editing now.
@@EdjeElectronics happy to hear that sir, thank you for uploading such helpful videos
I am using your card images in your tensorflow 1 on Windows 10 to train on mediapipe-model-maker. I got the model.tflite in floating point format. The training take less than 10 minutes and the result seems to be acceptable when I am using in my Raspberry Pi4. However, I only get around 2.5 fps. I wonder if the model is compatible with your tflite model. Do you know how to convert it to edge tpu format?
Hi, I have encountered a problam everything works fine until i get to Start training a model. It displays log text but after about 3 minutes RAM usage go to max and script just exit. Please HELP!! i have this for a school project and I'm running out of time. Thanks
Does the script end with^C? I think I encountered this error too...
Hey were you able to solve this issue?
Please keep making great videos. Awesome content.
Great video intesetd if you have
Instructions to run TFLite models on mac os
excuse me sir, i want trouble notif "Corrupt JPEG data: 251 extraneous bytes before marker 0xd9" how to the fix this sir ? thaks you
Wonderful, thanks for the efforts for explaining step by step
Good news! Training on GPU is working again. Thank you @markwassef8643 for finding the solution.
I got an issue with not being able to connect to GPU Backend for the google collab session will that affect the object detection model?
Hi, a great video here! However, I have a question, if i stop the training, how can i retrain from a checkpoint?
Yes - copy the last checkpoint files (2 files with same number) under "training" and the index file. When starting again, create the training directory manually and copy the files into the directory before you start training again. This worked for me. It just picks up from where it left off and you can see the loss continuing downward trend :D
@@oculushut7205 Thanks bro
It would be interesting if you will try same model on OrangePi 5/RockPi 5B that have NPU or Orange Pi AI USB Stick. Coral and Intel USB sticks are not available right now.
I just got my OrangePi 5 in the mail! Pretty excited to use it. I'm going to post a benchmarking video in the next month or two. You're right, though, Coral USB Accelerators are hard to get a hold of (and production of the Intel NCS2 has been cancelled).
The best tutorial in the world! :) Please could you modify the code on Google Colab in the future so that training also works for negative images and xml files without objects in them? Now it gives errors. Thank you so much, we love you!
Thank you for the wonderful breakdown !! Can you do a tutorial on how to deploy on android please
Hello, I would want to ask you if there is a way for the model to be able to detect more than 10 objects from a single cloud. I am trying to make a cloud detection algorithm using a Raspberry Pi 4 and a Coral TPU. For that I need the model to be able to detect more than 10 clouds. Is it possible to do with your code? If so, what do I need to change in the config?
I noticed the 10 object limitation too. I'm still trying to figure out how to change that in the config. For now, you can use TFLite Model Maker to train an EffiicientDet-Lite model, those ones are able to detect more than 10 objects.
www.tensorflow.org/lite/models/modify/model_maker/object_detection
@@EdjeElectronics Thanks for the swift and helpful reply
Any fix for this issue?