Hey everyone! I recently updated the written version of this guide to work with TensorFlow versions up to 1.13.1. If you are encountering errors following this video, please check out the guide and make sure you are using the most up-to-date commands. Here are answers to some common questions: - Where is the train.py file? The train.py file is now located in the /object_detection/legacy folder. You can copy it to the /object_detection folder and use it as normal. - Images aren't appearing when testing the Jupyter notebook, even though there were no errors? Try this: go in to object_detection/utils/visualization_utils.py and comment out the import statements on line 25 and 26 that include matplotlib. Then, re-run the script. - Can I run this just using CPU and not GPU? (Yes, just use "pip install tensorflow" instead of "pip install tensorflow-gpu".) - How to resolve errors related to _pb2 files? See Step 2f of the guide linked below. Check out the guide at github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 !
Thanks for the update! I managed to get through 90% of the tutorial a week and a half ago and couldnt figure out what the heck went wrong on the final stretch. Will give it another shot!
I followed the instructions in your tutorial but I'm having this error in jupyter when running object_detection_tutorial. No idea how to solve it as the import instructions are already there... i.imgur.com/wp5rtFO.png
13:38 -> you will find the setup.py in the slim folder copy that into research folder 13:59 -> Object_detection_tutorial.ipynb - Is located in the "object_detection\colab_tutorials" for anyone who can't find it 24:19 -> according to fixed comments, train.py file is now located in the /object_detection/legacy folder. fpn_pb2 -> protoc --python_out=. .\object_detection\protos\fpn.proto center_net_pb2 - > protoc --python_out=. .\object_detection\protos\center_net.proto official -> pip install tf-models-official etc... ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ If these error were found, I think you should start again from the beginning
weeks on the search for a good start tutorial that doesn't have 50+ parts and this is where I land. One of the best clear and concise tutorial/introduction video I've seen so far! Keep it up!!
Here are the issues that have been found so far with this tutorial: - TensorFlow moved the train.py file used in Step 6 to the "legacy" folder inside the /object_detection folder. You can still use it by moving it back into the /object_detection folder. - If the images aren't appearing in Jupyter notebook at the end of Step 2, try going in to object_detection/utils/visualization_utils.py and comment out both the import statements at the top that include matplotlib. Then, try re-running the Jupyter notebook. - Starting at 21:41, I say to change the num_classes variable to 6, but I accidentally changed it to 36. It should be 6. (Thanks Rafael!) - Google may add more .proto files to the object_detection/protos folder, so it may be necessary to add more files to the "protoc" command at 13:13. You can do this by adding ".\object_detection\protos\FILENAME.proto" to the end of the long command string for each new file. (Thanks exnaruto1!) - When running the "python train.py" command, if you get an error that says "TypeError: __init__() got an unexpected keyword argument 'dct_method'.", then remove the "dct_method=dct_method" argument from line 110 of the object_detection/data_decoders/tf_example_decoder.py file. (Thanks Evpatoria!) - When running "python train.py", if you get an error saying "google.protobuf.text_format.ParseError: 110:25 : Expected string but found: '“' ", try re-typing the quotation marks around each of the filepaths. If you copied the filepaths over from my GitHub tutorial, the quotation marks sometimes copy over as a different character type, and TensorFlow doesn't like that. - For train.py, if you get an error saying "TypeError: Expected int32, got range(0, 3) of type 'range' instead.", it is likely an issue with the learning_schedules.py file. In the \object_detection\utils\learning_schedules.py file, change line 153 from "tf.constant(range(num_boundaries), dtype=tf.int32)," to "tf.constant(list(range(num_boundaries)), dtype=tf.int32),". - If you are still getting an error complaining about "Expected int32, got range(0, 3)" or something similar, try implementing this fix: github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/issues/11 Please let me know if you see any more errors with the video or with the commands/instructions from my GitHub repository!
This is a great tutorial, thanks for making it. I think I found a small error at 12:01 (ruclips.net/video/Rgpfk6eYxJA/видео.html) when you're setting the PATH variable, I think the line should read: SET PATH=%PATH%;%PYTHONPATH% or else it won't add the value of the PYTHONPATH variable to the PATH, it'll just add the string PYTHONPATH. If it still works, maybe you don't need to modify the PATH at all, just the PYTHONPATH?
Hmm, I tested it out, and you're right! You only need to set the PYTHONPATH variable; you don't need to make any changes to PATH. I thought adding "PYTHONPATH" to PATH added the variable itself, not just a "PYTHONPATH" string. I'm not very familiar with environment variables :)
WEBCAM VIDEO LAG ISSUE! I have trained my own object classifier using your method with the webcam, the classification is perfect, but I'm facing an issue with the real-time video feed, ie the video lags a lot. Can you please help me this issue? Thank you.
Hey all, I just uploaded a new video showing how to train TensorFlow object detection models inside your web browser with Google Colab. It's much easier than trying to follow this video! Check it out here: ruclips.net/video/XZ7FYAMCc4M/видео.html
a shortcut while labelling the images is to make use of w - to start capturing the area (selecting) d- to move to the next image also , auto save your work
These settings seem to work for me : Tensorflow 1.13.1 Tensorflow-gpu 1.15 Cuda version 10.0 *Important* : From tensorflow model github repo, Only clone from the branch "r1.13.0" otherwise it will not work
@@renakiravtuber first i install tensorflow with this command : pip install tensorflow==1.13.1 --ignore-installed and then i installed tensorflow-gpu with this command : pip install tensorflow-gpu==1.15 notice that i didn't put --ignore-installed in tensorflow-gpu as it messes up all the packages for tensorflow 1.13.1
@@renakiravtuber I used cuda version 10.0 and cudnn v7.6.5 for cuda 10.0 Make sure to update your graphic card driver to the latest version I have this gpu : 920MX (for laptop)
24:15 i keep getting the following error - ImportError: No module named 'tensorflow.compat' - is there any solution to this, ive scowered the internet and cant find one
You deserve a lot of credit for making this video. There are many tensorflow/machine learning tutorials online but few that really show you this detailed from getting started to creating your model and training it.
thanks for this tutorial, was looking for something exactly like this, other videos don't go into details like, just skip here and there bam already trained data and detecting, i wanted to know how it looks like from start to finish cuz it was hard just trying to grasp text tutorials.
Thanks! If you run into issues while working through the guide, be sure to check my written guide. It has small updates for newer versions of TensorFlow (my pinned comment on this video also shows what the updates are): github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
For those of you looking for the new zoo model link: github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md The Jupyter notebook is now in: C:\tensorflow1\models esearch\object_detection\colab_tutorials Update: I got the project to working.. what you guys should really do is: Clone the git repository and then switch to the branch version of the video, this way you guys will have the same directory structure as shown in the video.
@@GarethBolton you should only do this if you're having trouble following the tutorial for file directories.. because these are the new locations of the model and the notebook. You can look at the guideline in the GitHub repo if you're doing everything right and the images don't show up.
This is the exact explanation that I needed it about how the training process gets "stored" with the 5 minutes checkpoints by tensorflow. I'll try to replicate this in a Mac environment and then somewhere in the cloud. Thanks for this video, you rocks!
this tutorial won't work on tensorflow version 2.0 try these settings as they seem to work for me : Tensorflow 1.13.1 Tensorflow-gpu 1.15 Cuda version 10.0 Important : From tensorflow model github repo, Only clone from the branch "r1.13.0" otherwise it will not work
@@mohamedimran3193 I checked the research/slim folder and there is already a file called "build". Aka in the newer version of tensorflow object detection API u dont need to run these sepcific set of commands. If I were you I wouldnt follow this tutorial as I ran into a ton of errors pertaining to me using outdated resources mentioned in the tutorials description.
@@cirianar Thank you for your inputs!. So you mean, it's not a good idea to follow this outdated tutorial? or you have something better than can help me. Because I'm badly in need of doing an object detection model for one of my projects
For those who have been stuck with choosing versions of software and modules to use, this is my additional suggestion. I am using Windows 10 pro. - Installing Anaconda: I chose the last version of anaconda released in 2018 which supports python 3.7.1. Technically, you can use the latest released version. - Python version: 3.7.1 - Tensorflow ver 1.13.1 goes along with its Github commit: github.com/tensorflow/models/tree/r1.13.0 - NumPy version 1.16.4 - pandas version 1.1.5 - Matplotlib version 3.0 For the rest, I just follow the author's instructions and the support from other guys here. Thanks a lot.
I have a problem while initialising the training File "train.py", line 48, in from tensorflow.contrib import framework as contrib_framework ModuleNotFoundError: No module named 'tensorflow.contrib' If any one have solution to this please help.
Yess...i got the same error... Bcoz I was using tensorflow 2.x, but it is not yet compatible for training purpose... So u should use tensorflow 1.14 for training
To everyone having issues with tensorflow 'app' or tensorflow 'contrib' . You need to downgrade your tensorflow version to 1.14. Using tensorflow 2.0 onwards doesn't work. even if you use compat.v1, since 'contrib' was completely removed from tf 2. EDIT: for those of you wondering how to do this, go into terminal and activate tensorflow1 environment pip uninstall tensorflow Wait for it to uninstall pip install tensorflow-gpu==1.14 Wait for it to install and you should be good to go. Be aware that you will have to download the correct versions of CUDA and CUDNN
@@TheAndre2131 Yes, it's Traceback (most recent call last): File "model_main.py", line 26, in from object_detection import model_lib File "/home/pi/tensorflowgit/Tensordatensatz/models/research/object_detection/model_lib.py", line 27, in from object_detection import eval_util File "/home/pi/tensorflowgit/Tensordatensatz/models/research/object_detection/eval_util.py", line 40, in slim = tf.contrib.slim File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/util/lazy_loader.py", line 62, in __getattr__ module = self._load() File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/util/lazy_loader.py", line 45, in _load module = importlib.import_module(self.__name__) File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'tensorflow.contrib' Do you have any idea what's causing the error o0 ?
@@petermeier6501 well. Firstly, it's not recommended to use model main.py but instead to use test.py from the legacy folder. Moreover you shouldn't be getting this error if you're using tf1.x could you check if you're in the Correct environement and uninstall and reinstall tensorflow Just in case
@@TheAndre2131thanks for the suggestions :), using the train.py file in the legacy folder or reinstalling tf unfortunately didn't do the trick. Trying other models and tf versions now.
Use the solution here which also gives coordinate information and detection confidence: github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/issues/69
please help me with this error: (tensorflow1) C:\tensorflow1\models esearch>python setup.py build python: can't open file 'C:\\tensorflow1\\models\ esearch\\setup.py': [Errno 2] No such file or directory
For Tensorflow 2.0 use following command to upgrade generate_tfrecord.py on anaconda promt tf_upgrade_v2 --infile generate_tfrecord.py --outfile generate_tfrecord_new.py Also in line 23 replace # flags = tf.app.flags flags = tf.compat.v1.flags
@@badcode8037 Make sure you use the correct file, generate_tfrecord_new.py, when you run the command(python generate_tfrecord_new.py --csv_input=images\test_labels.csv --image_dir=images\test --output_path=test.record). Otherwise you will get the same error again.
So, for anyone who is trying to use this tutorial in january 2020, with a ton of help I've finally made it to work out. Here's how: For Tensorflow-GPU: Download and install NVIDIA CUDA 10.0 Download cuDNN 7.4.2 for CUDA 10.0 -> open archieve and navigate to the 'bin' folder -> extract the only dll file from there to the CUDA v10.0/bin directory Your Tensorflow-GPU is ready to work! If you want to use Tensorflow-CPU ignore the steps from above Next: Download the latest version of models from the github repo linked in the description Download the faster_rcnn_inception archieve and extract it into the models/research/object_detection Download the Object-Detector API from the repo and extract it's files into models/research/object_detection Inside models/research/object_detection delete the inference_graph folder content, as well as the 2 csv files from images and the content of the training folder Open an Anaconda Command prompt and create a virtual env: C:\>conda create -n tensorflow1 pip python=3.6.10 //the 3.6.10 version its working with my overall setup C:\>activate tensorflow1 (tensorflow1) C:\>pip install tensorflow-gpu==1.13.1 //the 1.13.1 version is working as well (tensorflow1) C:\> conda install -c anaconda protobuf (tensorflow1) C:\> pip install pillow (tensorflow1) C:\> pip install lxml (tensorflow1) C:\> pip install Cython (tensorflow1) C:\> pip install contextlib2 (tensorflow1) C:\> pip install jupyter (tensorflow1) C:\> pip install matplotlib (tensorflow1) C:\> pip install pandas (tensorflow1) C:\> pip install opencv-python now uninstall numpy: (tensorflow1) C:\> pip uninstall numpy (tensorflow1) C:\> pip install numpy==1.16.4 //the 1.16.4 v is working (tensorflow1) C:\> set PYTHONPATH=C:\tensorflow1\models;C:\tensorflow1\models esearch;C:\tensorflow1\models esearch\slim (tensorflow1) C:\> cd C:\tensorflow1\models esearch NOW very important: open a file manager and navigate to tensorflow1/models/research/object_detection and search for the "protos" folder. Inside this folder you'll see a bunch of .proto files -> you need to make a .pb2 file instance for every single .proto file. DO NOT USE the long command from the written tutorial (protoc --python_out=. .\object_detection\protos\anchor_generator.proto .\object_detection\protos\argmax_matcher.proto......) Instead, look up for the first .proto file u see inside this folder and write the next command: (tensorflow1) C:\>protoc --python_out=. .\object_detection\protos\file_name.proto Repeat this command for every file you see inside the folder untill you make sure that every single .proto file has a .pb2 copy (it takes some time but it's the way to go) Next: (tensorflow1) C:\tensorflow1\models esearch> python setup.py build (tensorflow1) C:\tensorflow1\models esearch> python setup.py install BEFORE RUNNING THE JUPYTER COMMAND download the models file for version 1.7 from github -> open the archieve and search for /research/object_detection/object_detection_tutorial.ipynb -> extract that specific file into YOUR ACTUAL MODEL and replace it's own object_detection_tutorial.ipynb (otherwise it will mess your tensorflow version) Also, I'm not sure if this whole jupyter step is necessary since I'm still having an import error and the images are not showing, but it's still working out. Next: (tensorflow1) C:\tensorflow1\models esearch\object_detection> python xml_to_csv.py Then, generate the TFRecord files by issuing these commands from the \object_detection folder: python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record python generate_tfrecord.py --csv_input=images\test_labels.csv --image_dir=images\test --output_path=test.record Do the labelmap thing just as in the tutorial, it's nothing to explain here !! Make sure to modify those specific lines inside the config file just as in the written tutorial And now you can run the training : python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config Hope it works ! Let me know if it is woking for any of you ! Have a good day!
Hi, I'm trying to download the research models (/research/object_detection/object_detection_tutorial.ipynb) from version 1.7 from github, but the research models for all non-current versions were removed?
@@getlost1997 Here is the link for 1.7 models: github.com/tensorflow/models/tree/adfd5a3aca41638aa9fb297c5095f33d64446d8f Just download this and replace the object_detection_tutorial.ipynb file in the newest model.
@EdjeElectronics Hi, I'm in the middle of Step 6 trying to run the training, but when I do so, I come up with "ValueError: No variables to save. " Does this issue sound familiar?
facing error like this File "generate_tfrecord.py", line 23, in flags = tf.app.flags AttributeError: module 'tensorflow' has no attribute 'app' please help
@@aidos9753 So if I use tensorflow CPU I can just follow the other steps the same way, it just probably needs longer to train the network? And as far as I understood CUDA and cuDNN are also for GPU support? Do I still need to install them?
@@offifee8022Correct, you don't need to install CUDA and cuDNN. Instead of issuing "pip install tensorflow-gpu" just do "pip install tensorflow". But training will take much longer!
Hi. On your example,your frozen file model is about 50Mb. But mine is 200 or 300 Mb. Why is this big? Is there a problem with the construction or anything im doing? And the file size impacts on video detecting? Thanks for your help.
@@TheRAZSOR The absence of a setup.py file in the "research" folder is the cause of the problem, but I am still confused about how to solve it. Did you solve this problem?
I move "setup.py" file from "C:\tensorflow1\models esearch\object_detection\packages\tf2" (or tf1) folder to "C:\tensorflow1\models esearch" folder and I move "object_detection_tutorial.ipynb" file from "C:\tensorflow1\models esearch\object_detection\colab_tutorials" folder to "C:\tensorflow1\models esearch\object_detection" too for next process, that work for me.
I had trouble when trying to generate the TFRecord with this command: "C:\tensorflow1\models esearch\object_detection>python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record" It says: "from object_detection.utils import dataset_util ModuleNotFoundError: No module named 'object_detection'". Does anyone knows how to solve this?
faster_rcnn_inception_v2 is not compatible with tensorflow v2.x Is there any way other than uninstall current version and install 1.x older versions? Would you recommend me other model compatible to current tensorflow version?
Hello, here are some tips on what helped me run this model. It includes the versions of the packages that i installed aswell as some notes on how to work arround the steps 1 and 2 of the GitHub manual. I have yet to try and run it with my own personal images so don't expect automatic results... NAME OF MY CONDA ENV: tf1.13 GPU: nvidia quadro k620 VERSIONS: cudnn 7.3.1 cuda 10.0_0 tensorflow-gpu 1.13.1 tensorflow-estimator 1.13.0 tensorflow 1.13.1 pip 10.0.1 protobuf 3.6.0 python 3.5 pillow 7.0.0 lxml 4.4.2 cython 0.29.15 contextlib2 0.6.0.post1 jupyter 1.0.0 jupyter-client 6.0.0 jupyter-console 6.1.0 jupyter-core 4.6.3 matplotlib 3.0.3 pandas 0.25.3 opencv-python 4.2.0.32 INSTALLING: pip install --ignore-installed --upgrade tensorflow==1.13.1 conda install -c anaconda cudnn==7.3.1 -> equivalent to 7.4 CHECKING: conda list NAMEOFPACKAGE SET PATHS: set PYTHONPATH=C:\tf1.13\models;C:\tf1.13\models esearch;C:\tf1.13\models esearch\slim CHECKING: echo %PYTHONPATH% PROTOBUF COMMAND EXCEPTIONS: REMOVED FROM ORIGINAL \object_detection\protos\calibration.proto . -> DOES NOT EXIST WITH TF1.13 \object_detection\protos\flexible_grid_anchor_generator.proto. -> DOES NOT EXIST WITH TF1.13 SETUP BUILD: cd C:\tf1.13\models esearch python setup.py build python setup.py install EXECUTE LOCALHOST DEMO: cd C:\tf1.13\models esearch\object_detection jupyter notebook object_detection_tutorial.ipynb LINKS: TENSORFLOW / PYTHON / CUDA / CUDNN - VERSIONS : www.tensorflow.org/install/source#tested_build_configurations PREBUILT MODELS: github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md ssd -> low CPU MAIN PROJECT: github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#1-install-anaconda-cuda-and-cudnn I also ran into some DLL problems when executing the jupyter notebook because my Python folder had two. It only took removing one of them to work... I hope this helps you!
Hi Edje, Thankyou so much for such a beautiful tutorial. I am using Tensorflow 2.0 and was successful in creating the record file, but when trying this "python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config" I am encountering with an issue "File "train.py", line 49, in from tensorflow.contrib import framework as contrib_framework ImportError: No module named 'tensorflow.contrib'" Also tried to downgrade the Tensorflow version, but still not working. Any feedback would be greatly appreciated.
@Edje Electronics I would like to report using your tutorial as a starting point and a lot of googling! I was able to: 1. Translate all the required information to linux (Ubuntu 18.04) 2. Get Tensorflow Rocm working (Vega 56 AMD GPU) 3. Swap out the dataset with my own. Vega is humming along as I type this. Training now. Thanks for putting this detailed tutorial together. :)
I had this problem running jupyter file: "ImportError: DLL load failed importing win32api". Just type "conda install pywin32" and reaload. It works for me.
I am getting this error while exporting Inference Graph. File "C:\Users\Masked Lord\AppData\Roaming\Python\Python35\site-packages\tensorflow\contrib\framework\python\ops\gen_variable_ops.py", line 59, in _InitOpDefLibrary op_def_lib.add_op_list(op_list) NameError: name 'op_def_lib' is not defined
This is the old tutorial using TF 1.x, for Tensorflow 2.0 I advise you to visit tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html for further training you custom object detector.
Have you tried using this tutorial's repository (github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#4-generate-training-data) to successfully installed Tensorflow 2.x API?
@@O100OSTO I've tried it, but still got many errors due to the incompatibility of TF versions, In that link which I've mentioned above, is the same procedure as in the video. You can still install and use TF 1 and follow the tutorial, there is no problem for that)
I figured it out. If anyone gets the same error, after the final "else" in the generate_tfrecord.py change the last line to "return 0" instead of "return none" in the class_text_to_int function.
Guys. I have a problem. While executing python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config then, ImportError: cannot import name 'fpn_pb2' from 'object_detection.protos Do you know solution?
@Furkan Çelik you need to convert the fpn.proto to fpn_pb2 by adding .\object_detetction\protos\fpn.proto to the command he gave to convert the .protos file to _pb2, you can do this to any other file that has not been converted by just adding the file name after the protos part of my command
Hi, is there a way to get only the precision, recall, true positive, false positive and false negative values? I found that these values are calculated in the metrics.py file but I am unable to print/write these results to a csv file.
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see: * github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md * github.com/tensorflow/addons If you depend on functionality not listed there, please file an issue. Traceback (most recent call last): File "train.py", line 51, in from object_detection.builders import model_builder File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 20, in from object_detection.builders import anchor_generator_builder File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\anchor_generator_builder.py", line 22, in from object_detection.protos import anchor_generator_pb2 File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\anchor_generator_pb2.py", line 16, in from object_detection.protos import flexible_grid_anchor_generator_pb2 as object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2 ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' (C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\__init__.py) What should I do ???
me too. please help? WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see: * github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md * github.com/tensorflow/addons If you depend on functionality not listed there, please file an issue. Traceback (most recent call last): File "train.py", line 51, in from object_detection.builders import model_builder File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 20, in from object_detection.builders import anchor_generator_builder File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\anchor_generator_builder.py", line 22, in from object_detection.protos import anchor_generator_pb2 File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\anchor_generator_pb2.py", line 16, in from object_detection.protos import flexible_grid_anchor_generator_pb2 as object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2 ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' (C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\__init__.py)
@@EdjeElectronics Valorant is an upcoming fps from Riot Games (League of Legends developers). They promise a low ping, 128 tick rates and strong anti cheat. The game itself us a blend between CS:GO and Overwatch, where instead of buying grenades you should buy character abilities, that create tactical advantages. Today you can have the chance to get a key for closed beta.
excuse me, I want to ask something. What CUDA and CUDNN version do you use? I got error of Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
hi! I used CUDA Toolkit 10 and CUDNN 7.6 for tensorflow 1.13.1. Make sure you check system requirements of tensorflow ( www.tensorflow.org/install/source_windows (could be changed, depends on your OS)) and gpu support for tensorflow (I used nVIDIA GTX 1060 6gb). For some "unnormal" problems (like cannot find cudart64_91.dll cudart64_90.dll), I also install CUDA Toolkit ver 9.1 and 9.0. However, for both packages, I ONLY install the CUDA component (in custom installation options, uncheck Driver components, Other components, and GeForce Experience components). And I'm not using CUDNN for both package, just the main CUDA (10.0). Hope it'll help.
Important notes I've noticed while following this tutorial, 1.Type the full syntax command "conda create -n tensorflow1 pip python=x.x" *Python 3.6 is good enough* While creating your virtual environment, The default python version used with me was 3.7 which is not compatible with TensorFlow so far and I had to downgrade it. 2.The same problem but with TensorFlow version, I had Tensorflow 1.13.1, I had to downgrade it to 1.10.x to fix the error. Follow this link for more details about the error causes: github.com/tensorflow/tensorflow/issues/22794
I have made a working repo from the tutorials tf 1.13.1 tf gpu 1.15 all thanks fro Edje Electronics for the great tutorials github.com/mustafaazzurr/object_detection-with-Tensorflow-API
Good Day Sir. Can i ask a copy of your trained frozen_inference_graph of this tutorial? .. just want to compare with my trained frozen_inference_graph . Mine is slow in detecting. at what step did you stop in training? at what loss value?
Hi @Edje Electronics, I have a problem while initialising the training File "train.py", line 52, in from object_detection.builders import model_builder File "C:\tensorflow1\models esearch\object_detection\builders\model_builder.py", line 39, in from object_detection.utils import tf_version File "C:\tensorflow1\models esearch\object_detection\utils\tf_version.py", line 17, in from tensorflow.python import tf2 # pylint: disable=import-outside-toplevel ImportError: cannot import name 'tf2'
Excuse me, when I run the protoc --python_out, there's one warning, it said ( warning: Import object_detection/protos/image_resizer.proto is unused.) what should I do with it?
nguyễn đăng thắng That probably means the command doesn’t account for all the protos you should try protoc object_detection\protos\*.proto --python_out=.
@Edje Electronics Have you any idea how to execute the custom object detection model on tf 1.x after tensorflow Up-gradation to 2.x because when I cloned the repo it generates many issues with my model? I already run my model but after up-gradation of tensorflow (2.x) it doesn't work properly.
Hello, when I at trying to install jupyter in anaconda prompt as directed at 10:30, I get a huge error with 154 red lines in the prompt. Do you know what could be causing this and can you help? Everything else up until this point worked fine. I am using TensorFlow GPU 2.0
Hello, how many layers is this retraining? Only the last one (I suppose)? If so, is there a config setting somewhere that unfreezes/retrains multiple layers instead of just the output one? I'm training an SSD Mobilenet v2 quantized network (to compile into .tflite) and after over 30k steps it still isn't nearly as accurate as I'd like it to be (on my own dataset, not cards), so I thought I could improve the accuracy by transfer training more layers instead of just the last one. Thanks!
Hello, i am getting the following error when i start run the train via "python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config": TypeError: memoryview: a bytes-like object is required, not 'str' Can someone help please ?
Hey! I'm getting this error: Traceback (most recent call last): File "train.py", line 48, in from tensorflow import framework as contrib_framework ImportError: cannot import name 'framework' Can you help me with that?? (Im really not the only one)
Hi, I have few questions. 1. which version of protobuf should we install if we are working with tf 2.0? 2. Does switching between different tf versions breaks the whole configuration in current conda env where we installed all this ? I tried this with 2.0 but was'nt successful. I used the tf.compact.v1 as well but in when i ran train.py i threw error.
1)use 1.4 tf because tf 2.x version haven't some methods 2)what kind of error you faced? You can write to me directly cause i spent 3 days to get rid of all errors and finally i got success)
@@alexhaler3627 I constantly get the following error :AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'. I already tried tensorflow version 1.5gpu and then i get exact the same error but it says "v1"
@@alexhaler3627 thank you alex for reply. I successfully trained ssd Mobilenet quantized and faster rcnn v2 using tf 1.13 GPU. I faced lot of trouble in beginning of previous week but I did it.
@@alexhaler3627 Have you any idea how to execute the custom object detection model on tf 1.x after tensorflow Up-gradation to 2.x because when I cloned the repo it generates many issues with new tf version? I already run my model but after up-gradation of tensorflow it doesn't work properly.
@@alexhaler3627 please see i am using TF 1.13 Traceback (most recent call last): File "train1.py", line 49, in from object_detection.builders import dataset_builder File "C:\Users\Jasgun\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.8.egg\object_detection\builders\dataset_builder.py", line 27, in from object_detection.data_decoders import tf_example_decoder File "C:\Users\Jasgun\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.8.egg\object_detection\data_decoders\tf_example_decoder.py", line 27, in slim_example_decoder = tf.contrib.slim.tfexample_decoder AttributeError: module 'tensorflow' has no attribute 'contrib'
Hi, I've got another question . If I change parameters of faster RCNN in config file can it detect small objects??????? What should I do to be able to detect small objects in images????
Idle is not working in anaconda prompt. I've installed python 3.7.3 version and in tensorflow environment idle is not working, is there any other way that i cam run the object_detection_image.py file?
Wait... I'm confused... Why did you selected 'faster_rcnn_inception_v2_pets' config file instead of 'faster_rcnn_inception_v2_coco'?? Since you downloaded a coco model, therefore using coco config file would be an obvious thing to do, but you did it other way around... why??
That's a good question my friend... I used the pets file because that's how I did it the first time I set everything up on my own, and it worked. Since it worked, I didn't bother trying to use the coco config file. It would probably work with the coco file, you can try it if you like!
i need to classify my dataset of car make models images files with tensorflow but i work with more then 1600 car models ? which one i should choose it as a detector ? and i should use labelimg ? or i just work with the image ?
Hi! I want to create a tree detection using aerial drone pictures.... Would a training data set of around 900 images be enough? I would be annotating like 20 or more trees per image.. it's exhausting af.... would this be sufficient to get a pretty accurate detection? Thanks
Hi Ronello! Tree detection can be difficult depending on the situation. If you are trying to detect a tree alone in a field, it will be easy because it stands out among its surroundings. However, if you image contains lots of trees grouped together, it will have a hard time "seeing" how many trees there are. If the trees are clumped together it will probably just identify it as one big tree. Anyway... I would say you could start with 400 images and see how well it works, and continue adding from there. If it works decently well, add the next 500 images. If it doesn't work, you probably need to find another way to detect the trees. Good luck!
You mentioned it would be good to use newest TensorFlow but is there anyway to get this thing working on TF2.x? I have especially problems with tf.contrib that is depricated.
Good day sir.. in tensorflow demo (tf detect) it open directly the camera right? in my project, i want to create a button right their and open a new activity (e.g MainFrame) do you know how to do it? suggestion or recommend? thanks! PS: my projects runs in android device and I'm creating a mobile app detection using tf detect
ValueError: faster_rcnn_inception_v2 is not supported. See `model_builder.py` for features extractors compatible with different versions of Tensorflow while using python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training\faster_rcnn_inception_v2_pets.config which tensorflow version should i use?
TensorFlow 1.15 or if you want to use TensorFlow 2 use a different model which supports all. Check line 96 here. github.com/tensorflow/models/blob/master/research/object_detection/builders/model_builder.py
Great tutorial, I have a question regarding the last part. Although Object_detection_image.py works just fine, I cant seem to make my CNN detect cars in the video. also, I'm running object.detection_image on multiple images (I've edited the py file with some loops) but how can I calculate the accuracy of my model?
When it's identifying objects with a rectangle and threshold % is there a way to outline the identified object instead of just a rectangle around the entire object? Thanks
That's called image segmentation! I haven't dabbled with that yet. Here's a guide that looks to be useful: missinglink.ai/guides/tensorflow/tensorflow-image-segmentation-two-quick-tutorials/
During the model download steps on yout updated Junpyter script I am getting errors saying the file containing the model can't be found. yet I see no place to input a file path? >model_name = 'ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03' >detection_model = load_model(model_name) OSError: SavedModel file does not exist at: C:\Users\.keras\datasets\ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03\saved_model/{saved_model.pbtxt|saved_model.pb} Also why do we do this is we already downloaded the model from the model zoo before?
I'm running through the tutorial and getting no pictures at the end. No error messages either. I've commented out the two lines in visualization utils at lines 29 and 30 that reference matplotlib and saved the file. Am i doing something incorrect in re-running the script? I've tried doing rerun kernel and clear outputs then running everything again, and same result.
Hello, please help, when running the training command I get this error: File "C:\ProgramData\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_core\core\framework\tensor_shape_pb2.py", line 112, in '__module__' : 'tensorflow.core.framework.tensor_shape_pb2' TypeError: expected bytes, Descriptor found
Hi, I am stuck on the Jupyter notebook demo part of the video. I am not getting any errors and all the cells ran, but it doesn’t plot anything. I do get a warning that I am running low on memory but for the ssd_mobilenet, it should be fine right? Please let me know what might have caused the notebook to not display those plot images. Thanks!
Hello! Try going in to object_detection/utils/visualization_utils.py and comment out both the import statements at the top that include matplotlib. Then, try re-running the Jupyter notebook. Let me know if that works!
@@EdjeElectronics thanks for being so responsive in the comments on this relatively old video! I've had the comments open for like 4 days now as I've been following the tutorial, trying to help where I can. I'm stuck myself at the step where I generate the TFrecords. I've done it several times with no issue but now I get Traceback (most recent call last): File "generate_tfrecord.py", line 24, in flags = tf.app.flags AttributeError: module 'tensorflow' has no attribute 'app' google has been no help, and I've uninstalled and reinstalled throught conda and pip several times
@@coxfuture You're welcome! It makes for a nice thing to do at the end of a workday 😄. I plan to update my GitHub guide to the latest version of TF soon, hopefully that will resolve some people's errors. Hmm, I haven't seen that error before! Which version of TensorFlow are you working with? One general nuclear option to resolve problems is to start over and use TF v1.5 and download/use this old commit of the Models repository (which was the current commit when I made this video): github.com/tensorflow/models/tree/079d67d9a0b3407e8d074a200780f3835413ef99
@@EdjeElectronics Answer: I'm just an idiot. i put a folder called "tensorflow" in the working directory and it was calling from there. Thanks again for your help! I have a long way to go still :o
what alternative tool do i use instead of labelimg to labes non linear lines (transmission lines ) ; labelimg uses boxes which isn't helpful in my case
hi! I have a problem with detection.py, I try to do as your video but when I run detection (for image) the result is nothing, that mean do not have bonding box.
Edge Electronics : Hello I am trying to detect multiples images using object_detection_image.py but it gives me error "TypeError: join() argument must be str or bytes, not 'list' " What changes should I make in code so that it can read multiple images in a folder.
how to use this repo for the BDD100k dataset? Because the main problem is in BDD100k, all the training labels for all the training images are in a single Jason file unlike the one shown here where there is a separate .XML label file for each image! Thanks in advance!
Hey everyone! I recently updated the written version of this guide to work with TensorFlow versions up to 1.13.1. If you are encountering errors following this video, please check out the guide and make sure you are using the most up-to-date commands. Here are answers to some common questions:
- Where is the train.py file? The train.py file is now located in the /object_detection/legacy folder. You can copy it to the /object_detection folder and use it as normal.
- Images aren't appearing when testing the Jupyter notebook, even though there were no errors? Try this: go in to object_detection/utils/visualization_utils.py and comment out the import statements on line 25 and 26 that include matplotlib. Then, re-run the script.
- Can I run this just using CPU and not GPU? (Yes, just use "pip install tensorflow" instead of "pip install tensorflow-gpu".)
- How to resolve errors related to _pb2 files? See Step 2f of the guide linked below.
Check out the guide at github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 !
This step(which idk if is neccesary) still wasnt added to the written tutorial.-> 12:05
set PATH=%PATH%;PYTHONPATH
@@nicholaspitti8171 Yep, I removed it from the written tutorial because it isn't necessary!
i am constantly getting module not found error for tensorflow in jupyter notebook.I followed the instructions on the github page.
Thanks for the update! I managed to get through 90% of the tutorial a week and a half ago and couldnt figure out what the heck went wrong on the final stretch. Will give it another shot!
I followed the instructions in your tutorial but I'm having this error in jupyter when running object_detection_tutorial. No idea how to solve it as the import instructions are already there...
i.imgur.com/wp5rtFO.png
13:38 -> you will find the setup.py in the slim folder copy that into research folder
13:59 -> Object_detection_tutorial.ipynb - Is located in the "object_detection\colab_tutorials" for anyone who can't find it
24:19 -> according to fixed comments, train.py file is now located in the /object_detection/legacy folder.
fpn_pb2 -> protoc --python_out=. .\object_detection\protos\fpn.proto
center_net_pb2 - > protoc --python_out=. .\object_detection\protos\center_net.proto
official -> pip install tf-models-official
etc...
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
If these error were found, I think you should start again from the beginning
thank you so much I had run out of options.
THANKYOU SO MUCH BRO👍
i love you
i love you more
thank you kind sir!
weeks on the search for a good start tutorial that doesn't have 50+ parts and this is where I land. One of the best clear and concise tutorial/introduction video I've seen so far! Keep it up!!
Here are the issues that have been found so far with this tutorial:
- TensorFlow moved the train.py file used in Step 6 to the "legacy" folder inside the /object_detection folder. You can still use it by moving it back into the /object_detection folder.
- If the images aren't appearing in Jupyter notebook at the end of Step 2, try going in to object_detection/utils/visualization_utils.py and comment out both the import statements at the top that include matplotlib. Then, try re-running the Jupyter notebook.
- Starting at 21:41, I say to change the num_classes variable to 6, but I accidentally changed it to 36. It should be 6. (Thanks Rafael!)
- Google may add more .proto files to the object_detection/protos folder, so it may be necessary to add more files to the "protoc" command at 13:13. You can do this by adding ".\object_detection\protos\FILENAME.proto" to the end of the long command string for each new file. (Thanks exnaruto1!)
- When running the "python train.py" command, if you get an error that says "TypeError: __init__() got an unexpected keyword argument 'dct_method'.", then remove the "dct_method=dct_method" argument from line 110 of the object_detection/data_decoders/tf_example_decoder.py file. (Thanks Evpatoria!)
- When running "python train.py", if you get an error saying "google.protobuf.text_format.ParseError: 110:25 : Expected string but found: '“' ", try re-typing the quotation marks around each of the filepaths. If you copied the filepaths over from my GitHub tutorial, the quotation marks sometimes copy over as a different character type, and TensorFlow doesn't like that.
- For train.py, if you get an error saying "TypeError: Expected int32, got range(0, 3) of type 'range' instead.", it is likely an issue with the learning_schedules.py file. In the \object_detection\utils\learning_schedules.py file, change line 153
from "tf.constant(range(num_boundaries), dtype=tf.int32)," to "tf.constant(list(range(num_boundaries)), dtype=tf.int32),".
- If you are still getting an error complaining about "Expected int32, got range(0, 3)" or something similar, try implementing this fix: github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/issues/11
Please let me know if you see any more errors with the video or with the commands/instructions from my GitHub repository!
This is a great tutorial, thanks for making it.
I think I found a small error at 12:01 (ruclips.net/video/Rgpfk6eYxJA/видео.html) when you're setting the PATH variable, I think the line should read:
SET PATH=%PATH%;%PYTHONPATH%
or else it won't add the value of the PYTHONPATH variable to the PATH, it'll just add the string PYTHONPATH. If it still works, maybe you don't need to modify the PATH at all, just the PYTHONPATH?
Hmm, I tested it out, and you're right! You only need to set the PYTHONPATH variable; you don't need to make any changes to PATH. I thought adding "PYTHONPATH" to PATH added the variable itself, not just a "PYTHONPATH" string. I'm not very familiar with environment variables :)
WEBCAM VIDEO LAG ISSUE! I have trained my own object classifier using your method with the webcam, the classification is perfect, but I'm facing an issue with the real-time video feed, ie the video lags a lot. Can you please help me this issue? Thank you.
It seems like a few people are having this issue, so I will look in to it and try to figure it out!
yeah that would be of great help
Spent a whole night with this. Totally worth it. Amazing tut man...
Hey dude, What is the tensorflow version you used? I'm using 1.9 and I get an error while running training.py "Entry Point Not Found" got an idea?
Why worth it?
@Program-o-warrior hello sir could you please help me out. I got version problems with this video
@Program-o-warrior bro kindly help
Hey all, I just uploaded a new video showing how to train TensorFlow object detection models inside your web browser with Google Colab. It's much easier than trying to follow this video! Check it out here:
ruclips.net/video/XZ7FYAMCc4M/видео.html
but i do not conect gpu in google colab ?
very less start from scratch tutorials on youtube Thank you!!
God dude the beginning camera footage is so cool to watch
How much time and steps it took to train your dataset.?? @Good ki... Thank you
a shortcut while labelling the images is to make use of
w - to start capturing the area (selecting)
d- to move to the next image
also , auto save your work
Great Tutorial! Go to 16:20 for cat-cable ultimate battle!
You can master Object Detection in this specialized practical online course: learnml.today
These settings seem to work for me :
Tensorflow 1.13.1
Tensorflow-gpu 1.15
Cuda version 10.0
*Important* : From tensorflow model github repo, Only clone from the branch "r1.13.0" otherwise it will not work
Did u install tensorflow and tensorflow-gpu together? o.o
@@renakiravtuber first i install tensorflow with this command : pip install tensorflow==1.13.1 --ignore-installed
and then i installed tensorflow-gpu with this command : pip install tensorflow-gpu==1.15
notice that i didn't put --ignore-installed in tensorflow-gpu as it messes up all the packages for tensorflow 1.13.1
@Aero'N'Zero thanks :) what about ur CUDA and cudnn versions?
@@AeroAndZero what about ur cuda and cudnn versions
@@renakiravtuber I used cuda version 10.0 and cudnn v7.6.5 for cuda 10.0
Make sure to update your graphic card driver to the latest version
I have this gpu : 920MX (for laptop)
24:15 i keep getting the following error - ImportError: No module named 'tensorflow.compat' - is there any solution to this, ive scowered the internet and cant find one
Bro why is the code content in object_detection_tutorial.ipynb not same with the tutorial you make?
You deserve a lot of credit for making this video. There are many tensorflow/machine learning tutorials online but few that really show you this detailed from getting started to creating your model and training it.
Sir @Edje Electronics, does this work even if im not using Tensorflow-Gpu?
thanks for this tutorial, was looking for something exactly like this, other videos don't go into details like, just skip here and there bam already trained data and detecting, i wanted to know how it looks like from start to finish cuz it was hard just trying to grasp text tutorials.
Thanks! If you run into issues while working through the guide, be sure to check my written guide. It has small updates for newer versions of TensorFlow (my pinned comment on this video also shows what the updates are): github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
For those of you looking for the new zoo model link:
github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md
The Jupyter notebook is now in:
C:\tensorflow1\models
esearch\object_detection\colab_tutorials
Update: I got the project to working.. what you guys should really do is:
Clone the git repository and then switch to the branch version of the video, this way you guys will have the same directory structure as shown in the video.
9143 Rawaha Muhammad do I have to do this in order to see the images appear in the notebook? I ran it and no images appear
@@GarethBolton you should only do this if you're having trouble following the tutorial for file directories.. because these are the new locations of the model and the notebook.
You can look at the guideline in the GitHub repo if you're doing everything right and the images don't show up.
Which python and tensorflow version did you use?..I am getting many errors using tf 1.5
@@ano8929 same here
@@rawahamuhammad7805 kindly help for newer version
This is the exact explanation that I needed it about how the training process gets "stored" with the 5 minutes checkpoints by tensorflow. I'll try to replicate this in a Mac environment and then somewhere in the cloud. Thanks for this video, you rocks!
I am getting:
AttributeError: module 'tensorflow' has no attribute 'contrib'.
Any solution?
this tutorial won't work on tensorflow version 2.0
try these settings as they seem to work for me :
Tensorflow 1.13.1
Tensorflow-gpu 1.15
Cuda version 10.0
Important : From tensorflow model github repo, Only clone from the branch "r1.13.0" otherwise it will not work
Whenever I run the python setup.py build
/install command, it says it cant find a setup.py file in the directory of C:\tensorflow1\models
esearch>
@Edje Electronics, I'm also getting this error. Can someone help, please?
@@mohamedimran3193 I checked the research/slim folder and there is already a file called "build". Aka in the newer version of tensorflow object detection API u dont need to run these sepcific set of commands.
If I were you I wouldnt follow this tutorial as I ran into a ton of errors pertaining to me using outdated resources mentioned in the tutorials description.
@@cirianar Thank you for your inputs!. So you mean, it's not a good idea to follow this outdated tutorial? or you have something better than can help me. Because I'm badly in need of doing an object detection model for one of my projects
@@mohamedimran3193 the setup.py in the slim folder
For those who have been stuck with choosing versions of software and modules to use, this is my additional suggestion.
I am using Windows 10 pro.
- Installing Anaconda: I chose the last version of anaconda released in 2018 which supports python 3.7.1. Technically, you can use the latest released version.
- Python version: 3.7.1
- Tensorflow ver 1.13.1 goes along with its Github commit: github.com/tensorflow/models/tree/r1.13.0
- NumPy version 1.16.4
- pandas version 1.1.5
- Matplotlib version 3.0
For the rest, I just follow the author's instructions and the support from other guys here. Thanks a lot.
Thanks for helping out!
i couldn't get the images at 15:00 ,please help.
me neither, have you solved it yet?
Sir how to calculatr the accuracy of our model
i need to this alsow
I have a problem while initialising the training
File "train.py", line 48, in
from tensorflow.contrib import framework as contrib_framework
ModuleNotFoundError: No module named 'tensorflow.contrib'
If any one have solution to this please help.
Did anyone solve this?
Yess...i got the same error... Bcoz I was using tensorflow 2.x, but it is not yet compatible for training purpose... So u should use tensorflow 1.14 for training
github.com/tensorflow/models/issues/6423
U can follow this thread
To everyone having issues with tensorflow 'app' or tensorflow 'contrib' . You need to downgrade your tensorflow version to 1.14. Using tensorflow 2.0 onwards doesn't work. even if you use compat.v1, since 'contrib' was completely removed from tf 2.
EDIT: for those of you wondering how to do this, go into terminal and activate tensorflow1 environment
pip uninstall tensorflow
Wait for it to uninstall
pip install tensorflow-gpu==1.14
Wait for it to install and you should be good to go. Be aware that you will have to download the correct versions of CUDA and CUDNN
yeah, I'm facing the ' no module named contrib' -error although I'm using tf 1.14 since the beginning. mysterious :O
@@petermeier6501 can you copy paste the whole stack trace of your errors?
@@TheAndre2131 Yes, it's
Traceback (most recent call last):
File "model_main.py", line 26, in
from object_detection import model_lib
File "/home/pi/tensorflowgit/Tensordatensatz/models/research/object_detection/model_lib.py", line 27, in
from object_detection import eval_util
File "/home/pi/tensorflowgit/Tensordatensatz/models/research/object_detection/eval_util.py", line 40, in
slim = tf.contrib.slim
File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/util/lazy_loader.py", line 62, in __getattr__
module = self._load()
File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/util/lazy_loader.py", line 45, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'tensorflow.contrib'
Do you have any idea what's causing the error o0 ?
@@petermeier6501 well. Firstly, it's not recommended to use model main.py but instead to use test.py from the legacy folder. Moreover you shouldn't be getting this error if you're using tf1.x could you check if you're in the Correct environement and uninstall and reinstall tensorflow Just in case
@@TheAndre2131thanks for the suggestions :), using the train.py file in the legacy folder or reinstalling tf unfortunately didn't do the trick. Trying other models and tf versions now.
python: can't open file 'C:\tensorflow1\models
esearch\setup.py': [Errno 2] No such file or directory Can you help me ? I take this error.
C:\tensorflow1\models
esearch\slim find it here
i did this,you direct to slim and delete file Build then run it.
@@muhammadahmadraza3145 should i change directory to slim or move setup.py to folder research ??
@@nesacristin2913 move to folder reserach it worked
move to folder reserach it worked , move build to folder reserach it worked
Could you tell me how I print name of object as text when detected?
Use the solution here which also gives coordinate information and detection confidence:
github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/issues/69
please help me with this error:
(tensorflow1) C:\tensorflow1\models
esearch>python setup.py build
python: can't open file 'C:\\tensorflow1\\models\
esearch\\setup.py': [Errno 2] No such file or directory
I am also facing the same issue
you should try other models like tf 1.1 and so on , one of them have the setup.py in research folder
@@shahzebawan5540 Thank you.
@@shahzebawan5540 Hi, Can you elaborate I'm stuck at this?
I'm stuck at here too
For Tensorflow 2.0 use following command to upgrade generate_tfrecord.py on anaconda promt
tf_upgrade_v2 --infile generate_tfrecord.py --outfile generate_tfrecord_new.py
Also in line 23 replace
# flags = tf.app.flags
flags = tf.compat.v1.flags
Thanks! I will update my TensorFlow repository with this info when I get a chance.
I am still getting the same error :/
@@badcode8037 Make sure you use the correct file, generate_tfrecord_new.py, when you run the command(python generate_tfrecord_new.py --csv_input=images\test_labels.csv --image_dir=images\test --output_path=test.record). Otherwise you will get the same error again.
@@peterscales6020 Thanks a lot. It finally worked
@@peterscales6020 getting another error when i ran the train.py in cmd- AttributeError: module 'tensorflow' has no attribute 'contrib'
So, for anyone who is trying to use this tutorial in january 2020, with a ton of help I've finally made it to work out. Here's how:
For Tensorflow-GPU:
Download and install NVIDIA CUDA 10.0
Download cuDNN 7.4.2 for CUDA 10.0 -> open archieve and navigate to the 'bin' folder -> extract the only dll file from there to the CUDA v10.0/bin directory
Your Tensorflow-GPU is ready to work!
If you want to use Tensorflow-CPU ignore the steps from above
Next:
Download the latest version of models from the github repo linked in the description
Download the faster_rcnn_inception archieve and extract it into the models/research/object_detection
Download the Object-Detector API from the repo and extract it's files into models/research/object_detection
Inside models/research/object_detection delete the inference_graph folder content, as well as the 2 csv files from images and the content of the training folder
Open an Anaconda Command prompt and create a virtual env:
C:\>conda create -n tensorflow1 pip python=3.6.10 //the 3.6.10 version its working with my overall setup
C:\>activate tensorflow1
(tensorflow1) C:\>pip install tensorflow-gpu==1.13.1 //the 1.13.1 version is working as well
(tensorflow1) C:\> conda install -c anaconda protobuf
(tensorflow1) C:\> pip install pillow
(tensorflow1) C:\> pip install lxml
(tensorflow1) C:\> pip install Cython
(tensorflow1) C:\> pip install contextlib2
(tensorflow1) C:\> pip install jupyter
(tensorflow1) C:\> pip install matplotlib
(tensorflow1) C:\> pip install pandas
(tensorflow1) C:\> pip install opencv-python
now uninstall numpy:
(tensorflow1) C:\> pip uninstall numpy
(tensorflow1) C:\> pip install numpy==1.16.4 //the 1.16.4 v is working
(tensorflow1) C:\> set PYTHONPATH=C:\tensorflow1\models;C:\tensorflow1\models
esearch;C:\tensorflow1\models
esearch\slim
(tensorflow1) C:\> cd C:\tensorflow1\models
esearch
NOW very important: open a file manager and navigate to tensorflow1/models/research/object_detection and search for the "protos" folder.
Inside this folder you'll see a bunch of .proto files -> you need to make a .pb2 file instance for every single .proto file.
DO NOT USE the long command from the written tutorial (protoc --python_out=. .\object_detection\protos\anchor_generator.proto .\object_detection\protos\argmax_matcher.proto......)
Instead, look up for the first .proto file u see inside this folder and write the next command:
(tensorflow1) C:\>protoc --python_out=. .\object_detection\protos\file_name.proto
Repeat this command for every file you see inside the folder untill you make sure that every single .proto file has a .pb2 copy (it takes some time but it's the way to go)
Next:
(tensorflow1) C:\tensorflow1\models
esearch> python setup.py build
(tensorflow1) C:\tensorflow1\models
esearch> python setup.py install
BEFORE RUNNING THE JUPYTER COMMAND download the models file for version 1.7 from github -> open the archieve and search for /research/object_detection/object_detection_tutorial.ipynb -> extract that specific file into YOUR ACTUAL MODEL and replace it's own object_detection_tutorial.ipynb (otherwise it will mess your tensorflow version)
Also, I'm not sure if this whole jupyter step is necessary since I'm still having an import error and the images are not showing, but it's still working out.
Next:
(tensorflow1) C:\tensorflow1\models
esearch\object_detection> python xml_to_csv.py
Then, generate the TFRecord files by issuing these commands from the \object_detection folder:
python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record
python generate_tfrecord.py --csv_input=images\test_labels.csv --image_dir=images\test --output_path=test.record
Do the labelmap thing just as in the tutorial, it's nothing to explain here
!! Make sure to modify those specific lines inside the config file just as in the written tutorial
And now you can run the training :
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
Hope it works ! Let me know if it is woking for any of you ! Have a good day!
imgur.com/a/tKRb18h
while applying python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record
command
gotcha
Hi, I'm trying to download the research models (/research/object_detection/object_detection_tutorial.ipynb) from version 1.7 from github, but the research models for all non-current versions were removed?
@@getlost1997 Here is the link for 1.7 models:
github.com/tensorflow/models/tree/adfd5a3aca41638aa9fb297c5095f33d64446d8f
Just download this and replace the object_detection_tutorial.ipynb file in the newest model.
@@andrejpiecka Thank you!
@EdjeElectronics Hi, I'm in the middle of Step 6 trying to run the training, but when I do so, I come up with "ValueError: No variables to save. " Does this issue sound familiar?
facing error like this
File "generate_tfrecord.py", line 23, in
flags = tf.app.flags
AttributeError: module 'tensorflow' has no attribute 'app'
please help
Use tf-gpu version 1.15
@@presidentislive6297 I'm using tensorflow-gpu 2.1.0, are you saying i need to go backwards and use 1.15?
did you find a way to solve the error ? i got the same issue
Hi, want to ask, can i still done this if my laptop's graphic card is not Nvidea? Using intel graphic
Yes but you won't be able to use tensorflow-gpu as it is only compatible with Nvidia cards. You can still use tensorflow on the CPU tho.
@@aidos9753 So if I use tensorflow CPU I can just follow the other steps the same way, it just probably needs longer to train the network?
And as far as I understood CUDA and cuDNN are also for GPU support? Do I still need to install them?
@@offifee8022Correct, you don't need to install CUDA and cuDNN. Instead of issuing "pip install tensorflow-gpu" just do "pip install tensorflow". But training will take much longer!
@@offifee8022 That's correct. If you don't have an NVIDIA gpu you can use Tensorflow-CPU and do not need to install CUDA and cuDNN.
@@EdjeElectronics thank you very much!
I expected a longer training time, that's okay :)
Hi. On your example,your frozen file model is about 50Mb. But mine is 200 or 300 Mb. Why is this big? Is there a problem with the construction or anything im doing? And the file size impacts on video detecting? Thanks for your help.
When I run "python setup.py build" I get the following error: "[Errno 2] No such file or directory". Can anyone please help? Would be very kind
Did u find the solution?
Make sure to CD into object detection
@@blazingfest5885 Still not working!
@@TheRAZSOR The absence of a setup.py file in the "research" folder is the cause of the problem, but I am still confused about how to solve it. Did you solve this problem?
I move "setup.py" file from "C:\tensorflow1\models
esearch\object_detection\packages\tf2" (or tf1) folder to "C:\tensorflow1\models
esearch" folder and I move "object_detection_tutorial.ipynb" file from "C:\tensorflow1\models
esearch\object_detection\colab_tutorials" folder to "C:\tensorflow1\models
esearch\object_detection" too for next process, that work for me.
hey, just a small question .. can i use the trained model from my pc and run it on a pi?
Yes. U just need to convert your model.
I had trouble when trying to generate the TFRecord with this command:
"C:\tensorflow1\models
esearch\object_detection>python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record"
It says: "from object_detection.utils import dataset_util
ModuleNotFoundError: No module named 'object_detection'". Does anyone knows how to solve this?
You can try to recheck the label map in the training fold.
hello, have you solved this problem, i keep getting the same error and dont know what to do
Please slove this problem.
i have the same
pip install object-detection maybe?
faster_rcnn_inception_v2 is not compatible with tensorflow v2.x
Is there any way other than uninstall current version and install 1.x older versions?
Would you recommend me other model compatible to current tensorflow version?
Hello, here are some tips on what helped me run this model. It includes the versions of the packages that i installed aswell as some notes on how to work arround the steps 1 and 2 of the GitHub manual. I have yet to try and run it with my own personal images so don't expect automatic results...
NAME OF MY CONDA ENV:
tf1.13
GPU:
nvidia quadro k620
VERSIONS:
cudnn 7.3.1
cuda 10.0_0
tensorflow-gpu 1.13.1
tensorflow-estimator 1.13.0
tensorflow 1.13.1
pip 10.0.1
protobuf 3.6.0
python 3.5
pillow 7.0.0
lxml 4.4.2
cython 0.29.15
contextlib2 0.6.0.post1
jupyter 1.0.0
jupyter-client 6.0.0
jupyter-console 6.1.0
jupyter-core 4.6.3
matplotlib 3.0.3
pandas 0.25.3
opencv-python 4.2.0.32
INSTALLING:
pip install --ignore-installed --upgrade tensorflow==1.13.1
conda install -c anaconda cudnn==7.3.1 -> equivalent to 7.4
CHECKING:
conda list NAMEOFPACKAGE
SET PATHS:
set PYTHONPATH=C:\tf1.13\models;C:\tf1.13\models
esearch;C:\tf1.13\models
esearch\slim
CHECKING:
echo %PYTHONPATH%
PROTOBUF COMMAND EXCEPTIONS:
REMOVED FROM ORIGINAL
\object_detection\protos\calibration.proto . -> DOES NOT EXIST WITH TF1.13
\object_detection\protos\flexible_grid_anchor_generator.proto. -> DOES NOT EXIST WITH TF1.13
SETUP BUILD:
cd C:\tf1.13\models
esearch
python setup.py build
python setup.py install
EXECUTE LOCALHOST DEMO:
cd C:\tf1.13\models
esearch\object_detection
jupyter notebook object_detection_tutorial.ipynb
LINKS:
TENSORFLOW / PYTHON / CUDA / CUDNN - VERSIONS :
www.tensorflow.org/install/source#tested_build_configurations
PREBUILT MODELS:
github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
ssd -> low CPU
MAIN PROJECT:
github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#1-install-anaconda-cuda-and-cudnn
I also ran into some DLL problems when executing the jupyter notebook because my Python folder had two. It only took removing one of them to work...
I hope this helps you!
IMPORTANT:
numpy must be 1.16 or above
Hi Edje, Thankyou so much for such a beautiful tutorial. I am using Tensorflow 2.0 and was successful in creating the record file, but when trying this "python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config" I am encountering with an issue "File "train.py", line 49, in
from tensorflow.contrib import framework as contrib_framework
ImportError: No module named 'tensorflow.contrib'"
Also tried to downgrade the Tensorflow version, but still not working. Any feedback would be greatly appreciated.
Hi Edje, I am also encountering with same issue
Hi Edje I am also facing same issue
I am getting the same error as well
Jackie Staiger did you find any solution for this. If yes then please share this with us as well
@@jackiestaiger3056 Bro You need to Tensorflow downgrade to 1.5 and select the Image Detection code V.1.7 for git
Hi! I have no words to thank you. You really helped me. May Allah Pak bless you. Bundle of thanks :)
Have you trained a model?
@Edje Electronics I would like to report using your tutorial as a starting point and a lot of googling! I was able to:
1. Translate all the required information to linux (Ubuntu 18.04)
2. Get Tensorflow Rocm working (Vega 56 AMD GPU)
3. Swap out the dataset with my own.
Vega is humming along as I type this. Training now. Thanks for putting this detailed tutorial together. :)
Great! Glad it worked out! This video is getting a little dated, but the process is mostly the same. Just lots of version management to worry about!
I had this problem running jupyter file: "ImportError: DLL load failed importing win32api".
Just type "conda install pywin32" and reaload. It works for me.
By watching this video for 1 min, I found the PUBG and OW attract me more
i view don't have file setup.py in locations file C:\tensorflow1\models
esearch
me either
Did you solve it or not
I have the same error
did you solve this problem bro ,please?
Khánh Nguyễn Duy
1 giây trước
i did this,you direct to slim and delete file Build then run it.
Those who are also searching for the setup python file: github.com/tensorflow/models/blob/master/research/object_detection/packages/tf1/setup.py
I am getting this error while exporting Inference Graph.
File "C:\Users\Masked Lord\AppData\Roaming\Python\Python35\site-packages\tensorflow\contrib\framework\python\ops\gen_variable_ops.py", line 59, in _InitOpDefLibrary
op_def_lib.add_op_list(op_list)
NameError: name 'op_def_lib' is not defined
Sir can we run this in Google colab and if possible can you help me with the steps
Does anyone know how to count the detected objects?
This is the old tutorial using TF 1.x, for Tensorflow 2.0 I advise you to visit tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html for further training you custom object detector.
Have you tried using this tutorial's repository (github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#4-generate-training-data) to successfully installed Tensorflow 2.x API?
I just made a RUclips tutorial for the new TensorFlow 2 versions it's right here ruclips.net/video/oqd54apcgGE/видео.html
@@O100OSTO I've tried it, but still got many errors due to the incompatibility of TF versions, In that link which I've mentioned above, is the same procedure as in the video. You can still install and use TF 1 and follow the tutorial, there is no problem for that)
@@Armaan_Priyadarshan Great)
Patience required to complete, very excellent tutorial
I figured it out. If anyone gets the same error, after the final "else" in the generate_tfrecord.py change the last line to "return 0" instead of "return none" in the class_text_to_int function.
Thanks for posting your solution!
21:45 : 6 classes you mean 6 and not 36 right?
yes it will be 6 , my detection was accurate on 6
It should be 6, he did it by mistake
Guys. I have a problem. While executing python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
then,
ImportError: cannot import name 'fpn_pb2' from 'object_detection.protos
Do you know solution?
@Furkan Çelik you need to convert the fpn.proto to fpn_pb2 by adding .\object_detetction\protos\fpn.proto to the command he gave to convert the .protos file to _pb2, you can do this to any other file that has not been converted by just adding the file name after the protos part of my command
did you find a solution to this
Hi, is there a way to get only the precision, recall, true positive, false positive and false negative values? I found that these values are calculated in the metrics.py file but I am unable to print/write these results to a csv file.
Job offer regarding the same contents from this video. If you are interested and confident then pm me.
Thanks
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
* github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.
Traceback (most recent call last):
File "train.py", line 51, in
from object_detection.builders import model_builder
File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 20, in
from object_detection.builders import anchor_generator_builder
File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\anchor_generator_builder.py", line 22, in
from object_detection.protos import anchor_generator_pb2
File "C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\anchor_generator_pb2.py", line 16, in
from object_detection.protos import flexible_grid_anchor_generator_pb2 as object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' (C:\Users\admin\Anaconda3\envs\objectDetection\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\__init__.py)
What should I do ???
me too. please help?
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
* github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.
Traceback (most recent call last):
File "train.py", line 51, in
from object_detection.builders import model_builder
File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 20, in
from object_detection.builders import anchor_generator_builder
File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\anchor_generator_builder.py", line 22, in
from object_detection.protos import anchor_generator_pb2
File "C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\anchor_generator_pb2.py", line 16, in
from object_detection.protos import flexible_grid_anchor_generator_pb2 as object__detection_dot_protos_dot_flexible__grid__anchor__generator__pb2
ImportError: cannot import name 'flexible_grid_anchor_generator_pb2' from 'object_detection.protos' (C:\Users\Windows\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\protos\__init__.py)
Hi! I see you are playing shooters. Are you considering to try Valorant?
I haven't heard of Valorant, but I'll check it out! I mostly play CS:GO and Apex Legends nowadays :)
@@EdjeElectronics Valorant is an upcoming fps from Riot Games (League of Legends developers). They promise a low ping, 128 tick rates and strong anti cheat. The game itself us a blend between CS:GO and Overwatch, where instead of buying grenades you should buy character abilities, that create tactical advantages.
Today you can have the chance to get a key for closed beta.
excuse me, I want to ask something. What CUDA and CUDNN version do you use? I got error of Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
hi! I used CUDA Toolkit 10 and CUDNN 7.6 for tensorflow 1.13.1. Make sure you check system requirements of tensorflow ( www.tensorflow.org/install/source_windows (could be changed, depends on your OS)) and gpu support for tensorflow (I used nVIDIA GTX 1060 6gb).
For some "unnormal" problems (like cannot find cudart64_91.dll cudart64_90.dll), I also install CUDA Toolkit ver 9.1 and 9.0. However, for both packages, I ONLY install the CUDA component (in custom installation options, uncheck Driver components, Other components, and GeForce Experience components). And I'm not using CUDNN for both package, just the main CUDA (10.0). Hope it'll help.
@@ajisann yeah, thank you so much! my previous cuDNN version was 7.4, then I changed into 7.6 and it works.
Important notes I've noticed while following this tutorial,
1.Type the full syntax command "conda create -n tensorflow1 pip python=x.x" *Python 3.6 is good enough* While creating your virtual environment, The default python version used with me was 3.7 which is not compatible with TensorFlow so far and I had to downgrade it.
2.The same problem but with TensorFlow version, I had Tensorflow 1.13.1, I had to downgrade it to 1.10.x to fix the error.
Follow this link for more details about the error causes:
github.com/tensorflow/tensorflow/issues/22794
Hey, did train your own model? I wanna train a model that recognize systems screens, like outlook and etc... Could give me a help?
Nikko Morabe fabricio.siqueira9 my Skype
Nikko Morabe m.facebook.com/fabricio.siqueira.148
@Nikko Morabe Can you help me please,I have a similar issue.
I just used Anaconda navigator to create the environment and it worked for me. Using python 3.5 and tensorflow 1.12
This tutorial is too outdated, please update it
i got it with tensorflow gpu v 1.13 on this week
Me too, I managed to make it work with v1.15
@@denisardelean8067 i]m sorry guy what CUDA CUDNN your use i will try it today
@@rafaelromeromunhoz9826
Hello Rafael, I'm trying to Implement it, How did you generate the TF_Records?
@@denisardelean8067 Did you install everything as it is from step 2d?
I have made a working repo from the tutorials
tf 1.13.1
tf gpu 1.15
all thanks fro Edje Electronics for the great tutorials
github.com/mustafaazzurr/object_detection-with-Tensorflow-API
Good Day Sir. Can i ask a copy of your trained frozen_inference_graph of this tutorial? .. just want to compare with my trained frozen_inference_graph . Mine is slow in detecting. at what step did you stop in training? at what loss value?
@@jitzuzitro3305 it's slow also here, i tried the ssd v2 model and it worked way faster
@@jitzuzitro3305 for my dataset which contain over 1000 training images and 200 test images it took 50000 steps
@@muatafaalahmid7467 what is your graphics card sir? How many seconds/step did it take to train your model?
@@jitzuzitro3305 GTX1050 4gb
around 4-5 hours
Hi @Edje Electronics, I have a problem while initialising the training
File "train.py", line 52, in
from object_detection.builders import model_builder
File "C:\tensorflow1\models
esearch\object_detection\builders\model_builder.py", line 39, in
from object_detection.utils import tf_version
File "C:\tensorflow1\models
esearch\object_detection\utils\tf_version.py", line 17, in
from tensorflow.python import tf2 # pylint: disable=import-outside-toplevel
ImportError: cannot import name 'tf2'
num_classes: 36 (?)
Excuse me, when I run the protoc --python_out, there's one warning, it said ( warning: Import object_detection/protos/image_resizer.proto is unused.) what should I do with it?
nguyễn đăng thắng That probably means the command doesn’t account for all the protos you should try protoc object_detection\protos\*.proto --python_out=.
@Edje Electronics, I am getting error saying that the faster_rcnn_inception_v2 is not supported when running the train.py file
Will train.py file work on every model ? I am trying to train using "faster_rcnn_inception_resnet_v2_atrous_coco_2018_01_28".
@Edje Electronics Have you any idea how to execute the custom object detection model on tf 1.x after tensorflow Up-gradation to 2.x because when I cloned the repo it generates many issues with my model?
I already run my model but after up-gradation of tensorflow (2.x) it doesn't work properly.
Hello, when I at trying to install jupyter in anaconda prompt as directed at 10:30, I get a huge error with 154 red lines in the prompt. Do you know what could be causing this and can you help? Everything else up until this point worked fine. I am using TensorFlow GPU 2.0
I had doubt..
Image are you using for for the training are in the same resolution or in different?
How to export the inference graph to tflite?
Hello, how many layers is this retraining? Only the last one (I suppose)? If so, is there a config setting somewhere that unfreezes/retrains multiple layers instead of just the output one?
I'm training an SSD Mobilenet v2 quantized network (to compile into .tflite) and after over 30k steps it still isn't nearly as accurate as I'd like it to be (on my own dataset, not cards), so I thought I could improve the accuracy by transfer training more layers instead of just the last one.
Thanks!
What a fantastic Tutorial. I love the thoroughness. :)
Hello, i am getting the following error when i start run the train via "python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config":
TypeError: memoryview: a bytes-like object is required, not 'str'
Can someone help please ?
Hey! I'm getting this error:
Traceback (most recent call last):
File "train.py", line 48, in
from tensorflow import framework as contrib_framework
ImportError: cannot import name 'framework'
Can you help me with that?? (Im really not the only one)
i have face same issue
Hi, I have few questions.
1. which version of protobuf should we install if we are working with tf 2.0?
2. Does switching between different tf versions breaks the whole configuration in current conda env where we installed all this ?
I tried this with 2.0 but was'nt successful. I used the tf.compact.v1 as well but in when i ran train.py i threw error.
1)use 1.4 tf because tf 2.x version haven't some methods
2)what kind of error you faced?
You can write to me directly cause i spent 3 days to get rid of all errors and finally i got success)
@@alexhaler3627 I constantly get the following error :AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'.
I already tried tensorflow version 1.5gpu and then i get exact the same error but it says "v1"
@@alexhaler3627 thank you alex for reply. I successfully trained ssd Mobilenet quantized and faster rcnn v2 using tf 1.13 GPU. I faced lot of trouble in beginning of previous week but I did it.
@@alexhaler3627 Have you any idea how to execute the custom object detection model on tf 1.x after tensorflow Up-gradation to 2.x because when I cloned the repo it generates many issues with new tf version?
I already run my model but after up-gradation of tensorflow it doesn't work properly.
@@alexhaler3627
please see i am using TF 1.13
Traceback (most recent call last):
File "train1.py", line 49, in
from object_detection.builders import dataset_builder
File "C:\Users\Jasgun\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.8.egg\object_detection\builders\dataset_builder.py", line 27, in
from object_detection.data_decoders import tf_example_decoder
File "C:\Users\Jasgun\Anaconda3\envs\tensorflow1\lib\site-packages\object_detection-0.1-py3.8.egg\object_detection\data_decoders\tf_example_decoder.py", line 27, in
slim_example_decoder = tf.contrib.slim.tfexample_decoder
AttributeError: module 'tensorflow' has no attribute 'contrib'
Hi, I've got another question .
If I change parameters of faster RCNN in config file can it detect small objects???????
What should I do to be able to detect small objects in images????
Idle is not working in anaconda prompt. I've installed python 3.7.3 version and in tensorflow environment idle is not working, is there any other way that i cam run the object_detection_image.py file?
Wait... I'm confused... Why did you selected 'faster_rcnn_inception_v2_pets' config file instead of 'faster_rcnn_inception_v2_coco'?? Since you downloaded a coco model, therefore using coco config file would be an obvious thing to do, but you did it other way around... why??
That's a good question my friend... I used the pets file because that's how I did it the first time I set everything up on my own, and it worked. Since it worked, I didn't bother trying to use the coco config file. It would probably work with the coco file, you can try it if you like!
sir i have a problem , ModuleNotFoundError: No module named 'object_detection.predictors' how can i fix it
i need to classify my dataset of car make models images files with tensorflow but i work with more then 1600 car models ? which one i should choose it as a detector ? and i should use labelimg ? or i just work with the image ?
Hi! I want to create a tree detection using aerial drone pictures.... Would a training data set of around 900 images be enough? I would be annotating like 20 or more trees per image.. it's exhausting af.... would this be sufficient to get a pretty accurate detection? Thanks
Hi Ronello! Tree detection can be difficult depending on the situation. If you are trying to detect a tree alone in a field, it will be easy because it stands out among its surroundings. However, if you image contains lots of trees grouped together, it will have a hard time "seeing" how many trees there are. If the trees are clumped together it will probably just identify it as one big tree.
Anyway... I would say you could start with 400 images and see how well it works, and continue adding from there. If it works decently well, add the next 500 images. If it doesn't work, you probably need to find another way to detect the trees. Good luck!
You mentioned it would be good to use newest TensorFlow but is there anyway to get this thing working on TF2.x? I have especially problems with tf.contrib that is depricated.
Good day sir.. in tensorflow demo (tf detect) it open directly the camera right? in my project, i want to create a button right their and open a new activity (e.g MainFrame) do you know how to do it? suggestion or recommend? thanks!
PS: my projects runs in android device and I'm creating a mobile app detection using tf detect
Hmm, I haven't looked at tf detect yet, so I'm afraid I can't help. Hope you can figure it out!
Hi , if i want to train a specific type of object (eg. water bottle), for my image do i include 2 water bottle and only label one of it in the image?
One of the cleanest videos i´ve ever seen
ValueError: faster_rcnn_inception_v2 is not supported. See `model_builder.py` for features extractors compatible with different versions of Tensorflow
while using python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training\faster_rcnn_inception_v2_pets.config
which tensorflow version should i use?
TensorFlow 1.15
or if you want to use TensorFlow 2 use a different model which supports all.
Check line 96 here.
github.com/tensorflow/models/blob/master/research/object_detection/builders/model_builder.py
Great tutorial, I have a question regarding the last part.
Although Object_detection_image.py works just fine, I cant seem to make my CNN detect cars in the video.
also, I'm running object.detection_image on multiple images (I've edited the py file with some loops) but how can I calculate the accuracy of my model?
Hi I need your help. I trained the quantized ssd mobilenet v2 model but the lose is shooting back and forth. Why is it soo?
When it's identifying objects with a rectangle and threshold % is there a way to outline the identified object instead of just a rectangle around the entire object? Thanks
look into a mask-rcnn.
That's called image segmentation! I haven't dabbled with that yet. Here's a guide that looks to be useful: missinglink.ai/guides/tensorflow/tensorflow-image-segmentation-two-quick-tutorials/
can we use ssd_mobilenet_v2_coco instead of ssd_mobilenet_v2_quantised_coco model for this
During the model download steps on yout updated Junpyter script I am getting errors saying the file containing the model can't be found. yet I see no place to input a file path?
>model_name = 'ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03'
>detection_model = load_model(model_name)
OSError: SavedModel file does not exist at: C:\Users\.keras\datasets\ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03\saved_model/{saved_model.pbtxt|saved_model.pb}
Also why do we do this is we already downloaded the model from the model zoo before?
I'm running through the tutorial and getting no pictures at the end. No error messages either. I've commented out the two lines in visualization utils at lines 29 and 30 that reference matplotlib and saved the file. Am i doing something incorrect in re-running the script?
I've tried doing rerun kernel and clear outputs then running everything again, and same result.
Hello, please help, when running the training command I get this error:
File "C:\ProgramData\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_core\core\framework\tensor_shape_pb2.py", line 112, in
'__module__' : 'tensorflow.core.framework.tensor_shape_pb2'
TypeError: expected bytes, Descriptor found
Hi,
I am stuck on the Jupyter notebook demo part of the video. I am not getting any errors and all the cells ran, but it doesn’t plot anything. I do get a warning that I am running low on memory but for the ssd_mobilenet, it should be fine right? Please let me know what might have caused the notebook to not display those plot images. Thanks!
Hello! Try going in to object_detection/utils/visualization_utils.py and comment out both the import statements at the top that include matplotlib. Then, try re-running the Jupyter notebook. Let me know if that works!
Edje Electronics yes that worked and thank you so much!!
@@EdjeElectronics thanks for being so responsive in the comments on this relatively old video! I've had the comments open for like 4 days now as I've been following the tutorial, trying to help where I can.
I'm stuck myself at the step where I generate the TFrecords. I've done it several times with no issue but now I get
Traceback (most recent call last):
File "generate_tfrecord.py", line 24, in
flags = tf.app.flags
AttributeError: module 'tensorflow' has no attribute 'app'
google has been no help, and I've uninstalled and reinstalled throught conda and pip several times
@@coxfuture You're welcome! It makes for a nice thing to do at the end of a workday 😄. I plan to update my GitHub guide to the latest version of TF soon, hopefully that will resolve some people's errors.
Hmm, I haven't seen that error before! Which version of TensorFlow are you working with? One general nuclear option to resolve problems is to start over and use TF v1.5 and download/use this old commit of the Models repository (which was the current commit when I made this video): github.com/tensorflow/models/tree/079d67d9a0b3407e8d074a200780f3835413ef99
@@EdjeElectronics Answer: I'm just an idiot. i put a folder called "tensorflow" in the working directory and it was calling from there. Thanks again for your help!
I have a long way to go still :o
which classifier algorithm has been used for multiple object detection model by @Edje Electronics?
what alternative tool do i use instead of labelimg to labes non linear lines (transmission lines ) ; labelimg uses boxes which isn't helpful in my case
hi! I have a problem with detection.py, I try to do as your video but when I run detection (for image) the result is nothing, that mean do not have bonding box.
Edge Electronics : Hello I am trying to detect multiples images using object_detection_image.py but it gives me error "TypeError: join() argument must be str or bytes, not 'list' " What changes should I make in code so that it can read multiple images in a folder.
how to use this repo for the BDD100k dataset? Because the main problem is in BDD100k, all the training labels for all the training images are in a single Jason file unlike the one shown here where there is a separate .XML label file for each image!
Thanks in advance!
how can i see the accuracy graph like loss graph using tensor board?
please say me.