Это видео недоступно.
Сожалеем об этом.
How to Install Tensorflow 2 Object Detection
HTML-код
- Опубликовано: 17 авг 2024
- Its finally here! Welcome to my tutorial for installing and setting up Tensorflow 2 Object Detection! This tutorial goes over how to install Tensorflow 2 and get object detection up and running. I try to cover as many possible errors you may find when trying to do this yourself so that you can skip the headaches and get right to object detecting!
Watch the other videos in this series: • Tensorflow 2 Object De...
Common Tensorflow 2 fixes:
"protoc not found" - make sure you add protoc to path and also do "conda install protobuf"
"numpy not found" - make sure to do "conda install numpy"
Links used:
Tensorflow github: github.com/ten...
Tensorflow models: github.com/ten...
Protobuf download: github.com/pro...
Anaconda download: www.anaconda.com/
Code used in this tutorial: github.com/Ben...
Original inspiration: github.com/Tan...
Chapters:
00:00 - Download Tensorflow repo
01:40 - Protobuf/Protoc Download
04:10 - Anaconda
09:04 - protoc command and script
10:45 - setup.py
11:55 - numpy
12:40 - Test the install
14:10 - Setup IDE
17:10 - Model downloader
21:20 - Detection script
25:00 - Results
26:10 - Outro
Thank you so much! I spent so much time following different turorials but none worked but thankfully this one did. You're a life saver!
Great to hear!
Worked for me. Initially I faced some issues with the python version and protobuf. But after some version changing according to what is in video, all worked fine. Thank you for your detailed explanations through the video.
I got experimental error of keras version in testing of the installation can you please help me to sort it
Excellent channel bro, super simple and nobody left behind
jesus christ u saved me from smashing my head in. You are so articulate and actually address the 50 errors that occur. Thank you kind sir
had romed around over tons of tutorials for this but i hadn't seen this master piece you owe my respect brother
Thank you! After watching many tutorials, yours finally worked!!
Thank you for making this straight forward. This may be the only tutorial that i don't get a single error.
Glad it helped!
After three days of endless tries it finally works.... thanks my man you really deserve more attention. Most deserved like and sub ever.
Can you please tell for which version of protobuf which version of tenspeflow worked
Can anyone twll for what version of protobuf which tensorflow worked
Btw great tutorial i have been stuck for a few weeks trying to resolve installation errors following backdated tutorials. Thanks for helping solve my headaches :)😀
It was a great tutorial, ı couldn't do with other tutorials, but now it worked
Thank you brotha!!!Loved it...
finally I found it and managed to do things without screwing up
Watched so many Videos and read so many webites, but this is the first video which really helped and didn't skipped things. Thank you so much!
Happy to hear it! :)
Can you please say when you download the model is that savedmodel folder is coming directly because I downloaded manually and pasted folder over there so I don't have any saved model
@@LazyTech825 sir, while installing in gpu version i am having this issue sirImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/iot/miniconda3/envs/tf2/lib/python3.9/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-39-x86_64-linux-gnu.so) please resolve it and this would be great help
Can anyone twll for what version of protobuf which tensorflow worked
Thank you for making this so straightforward!!!!!
im stuck and setup.py 10.45 where it say Attribute error
Amazing guidance for beginner like me.
Thank you!!
Awesome tutorial!!! fixed common errors
Nice tutorial you save my life hehe
Thanks.
I'm using ubuntu and it works! thank you for sharing the video:)
very well explained...got the perfect outputs
Thank you for making this video!! REALLY HELPFUL!!
Glad it was helpful!
I get the following error when I run "python -m pip install ." after copying the set up file.
Pls help :(
"AttributeError: cython_sources"
Edit: had to do the following to solve the issue
pip install "Cython
thx a lot, got the same error.
For me
pip install "Cython
Thanks bud
amazing tutorial man. thank you so much
Thank you so much! Excellent tutorial
I have installed VS C++ libraries, installed procom and compiled using procom. Still getting "no module named object_detection" using tensorflow 1.13.1
hey, I actually loved your video and your effort. But I think it'll be better for us if you maintain larger font size & all. Thanks in advance : )
You are a legend brother !
I want to detect something similar but will have 2 different classes Yes and No, instead of detecting random items.. How to go about it?
Dunno what to say but thank you very much. +1 Sub gained!
You get through with it without any error bro?
Very helpful, Thank you so much for your effort!
Glad it was helpful!
just watched the custom object detection model video, good series! Now i can detect macaroni and cheese whenever i want :P
Go for it!
@@LazyTech825 sir, while installing in gpu version i am having this issue sirImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/iot/miniconda3/envs/tf2/lib/python3.9/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-39-x86_64-linux-gnu.so) please resolve it and this would be great help
Thank you for amazing tutorial!
Glad it was helpful!
I'm getting errors with tf.keras.experimental thing during test at 13:40
did someone else have the same issue?
Same issues
Thanks!
just thank you
Hello, great tutorial! I'm stuck at the part of 24:28.
The errors:
1. can't open file
2. [Errno 2] No such file or directory
Any thoughts on this? Thank you.
Same I am stuck here too
try this.. python .\detect_from_image.py -m .\ssd_mobilenet_v2_320x320_coco17_tpu-8\saved_model -l ..\.\data\mscoco_label_map.pbtxt -i ..\.\test_images
generally this is due to the argument pointing to a different location. see the difference in directories between where the py file is and the labemap and test images are.
i am executing that command from this location in my terminal: \Tensorflow\models
esearch\object_detection\utils>
my directory structure is like this:
object_detection
| - data
| | - mscoco_label_map.pbtxt
| - test_images
| - utils
| | - ssd_mobilenet_v2_320x320_coco17_tpu-8
| | | - saved_model
| | | - checkpoint
| | - ssd_mobilenet_v2_320x320_coco17_tpu-8.tar.gz
| | - detect_from_image.py
| | - model_downloader.py
hey @keithsoriano1083 you can solve this by delete 1 equal sign before the ssd_efficient.det. etc python model_main_tf2.py --pipeline_config_path=ssd_efficientdet_d0_512x512_coco17_tpu-8.config --model_dir==training --alsologtostderr. Hope this one helps
thanks for everything , but i did not find any images in the output folder after executing command, what can be the possible cause ?
thank so you sir, please make some detailed up to date videos of tensorflow 2.16.1 installation and bug fixing and serving model through app of server to app. and also cuda cudnn path setting and all, thanks in advance
That was a nice explanation thank you
Thanks for watching!
@@LazyTech825 sir, while installing in gpu version i am having this issue sirImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/iot/miniconda3/envs/tf2/lib/python3.9/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-39-x86_64-linux-gnu.so) please resolve it and this would be great help
Thanks for the tutorial it's a life saver!!!!!!!
Glad it helped! I have another video about making your own model coming out soon too!
I have a gpu on my PC but everytime I try to install tensorflow-gpu==2.10.0 ( is giving me an error) and if I try to install through conda it installs tensorflow-gpu=2.6 ( but I have tensorflow 2.10) so what should I do?
Thank you
can it install on macos?
Hi first thanks you helped me alot!! one question why do you make two anaconda env. second is tf_cpu but you open the first in pycharm?
I still get this error:
ModuleNotFoundError: No module named 'tensorflow.contrib'
great tutorial!
Glad you think so!
It works thank you ❤❤
Thanks for putting this together. I tried running detect_from_image with the command "python detect_from_image.py -m ssd_mobilenet_v2_coco_2018_03_29/saved_model/ -l data/mscoco_label_map.pbtxt -i test_images" (seemed to not find the files using your original format, so I ended up changing the \'s and whatnot.)
I got an error on the line "output_dict = model(input_tensor)" saying "Autotrackable object is not callable"
Any explanation/fix would be much appreciated.
Found the fix: "output_dict = model(input_tensor)" --> output_dict = model.signatures['serving_default'](input_tensor)
Question can u help I have like your error too
@@teniolatemidayo7438 Unfortunately, I ended up reinstalling (found I had version incompatibilities between TF, CUDA, and cuDNN) everything but never ran into this error afterward for some reason even though I didn't put the above change back.
from tensorflow.python.keras.layers.preprocessing import image_preprocessing as image_ops
ModuleNotFoundError: No module named 'tensorflow.python.keras.layers.preprocessing'
how to solve this error im stuck 2 days
Thank you so much. Now could you help me direct to the next step where I can custom train my own dataset?
Instead of detecting dogs, people and kites, how can I instead detect what I want to detect? Like my boxes or pencils?
My more recent videos show you how to make a custom dataset!
Amazing video!! Such a great explanation with clarity. If possible will you please make a video on custom object detection using tf2. I tried to follow your custom object detection videos from the year 2020. But I'm not able to use tf2 using the same process.
Thanks for watching! And yes! I plan on making a video for custom models!
@@LazyTech825 Please do!! It will help a lot. Can you please take objects something like previous videos like - people with masks and no masks in a picture, video....
Incredible video. I feel my computer skills just gave a quantum leap in other dimension
Great video! It helped me a lot! THANKS!
Glad to hear it!
Hi i want to use my gpu for training can you guide for that
I got this error at 13:27, can you please help, thanks!
C:\Users\user\models
esearch>python object_detection/builders/model_builder_tf2_test.py
Traceback (most recent call last):
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\object_detection\models\ssd_efficientnet_bifpn_feature_extractor.py", line 36, in
from official.legacy.image_classification.efficientnet import efficientnet_model
ModuleNotFoundError: No module named 'official.legacy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\models
esearch\object_detection\builders\model_builder_tf2_test.py", line 24, in
from object_detection.builders import model_builder
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\object_detection\builders\model_builder.py", line 70, in
from object_detection.models import ssd_efficientnet_bifpn_feature_extractor as ssd_efficientnet_bifpn
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\object_detection\models\ssd_efficientnet_bifpn_feature_extractor.py", line 38, in
from official.vision.image_classification.efficientnet import efficientnet_model
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\official\vision\image_classification\efficientnet\efficientnet_model.py", line 37, in
from official.vision.image_classification import preprocessing
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\official\vision\image_classification\preprocessing.py", line 25, in
from official.vision.image_classification import augment
File "C:\Users\user\.conda\envs\tf2\Lib\site-packages\official\vision\image_classification\augment.py", line 31, in
from tensorflow.python.keras.layers.preprocessing import image_preprocessing as image_ops
ModuleNotFoundError: No module named 'tensorflow.python.keras.layers.preprocessing'
You may need to update the Tensorflow 'pip install --upgrade tensorflow', and try it again. If doesn't work again check if there is a conflict with more than one Tensorflow version with 'pip list | grep tensorflow'. Hope it helps.
Hi, for those who are experiencing the same issue, I tried to create a conda env with a Pyhton version 3.10 and then it worked
@@enrico_ml95 i tried 3.10 still didnt work too
@durgasaranyudk7130 did you solve this?
Hi. Cool video, thx. I keep on getting ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects, at 11:48. Could you please help?
Thanks for watching! Try running 'pip install pycocotools' - if that doesn't work try 'pip install git+github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI'
@@LazyTech825 Typing pip install pycocotools gives me Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output], while pip install git + link returns an ERROR: Cannot unpack file, after it says that pip is being invoked by an old script wrapper. Any advice? Thx.
wait... was I supposed to run these commands inside anaconda, or in a normal command prompt outside it? Because I did the second.
Yes do it in conda and see if that works, everything should be done in that conda environment
@@LazyTech825 Hi! Okay, so everything's working now! Your tutorial's have been really helpful. (I subscribed and upvoted both). I still have two questions though - I hope you won't mind me asking. I'm running the TensorFlow Code on an MS Surface, and since I have 2 cameras, do you know how I would choose which one I want to see the webcam-detection on? Also, do you know how I could go about training my own model?
Thanks!
Hi Sir, I got an error at this step 24:28, it said:
from object_detection.utils import ops as utils_ops
ModuleNotFoundError: No module named 'object_detection'
and then i found that in these 3 .py files (in object_detection\utils folder)
from object_detection.utils import ops as utils_ops
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
the libraries called "six.moves" and "tensorflow.compat.v1" seems like these libraries didn't install yet. But i do the pip list and conda list, the "six" already installed, but the "tensorflow.compat.v1" doesn't have in the list. I have no idea how to fix this problem. Please help me, thank you.
You can try manually installing it with ‘conda install tensorflow.compat.v1’
It’s not work…
It looks like it can't find object_detection, try starting from the beginning and make sure you do the setup.py steps. If you miss that step it won't recognize the package
I had the same issue trying to run it in py charm, setup like the video. I switched back to the anaconda propt and run the python .\detect_from_image\.... from the object_detection directory and it worked. I'm guessing I've set up something incorrectly py charm.
@@adamdangerfieldsame problem did u fix your yet
Great tutorial! can you please explain how to train such models such models like Mobilenetv SSD on custom dataset. Thanks.
Yes! On my channel I have another video showing how to do that which is part of this tutorial series!
@@LazyTech825 Thanks a alot, I will see that then.
Thanks for the great video. I have a question, does anyone have experience implementing this on a PI 4 ? Especially Anaconda are difficult to install and Protobuf is difficult to change the system variables?
Thanks for the help
Check out my video on Tensorflow Lite for raspberry pi
Thank you, can you please help me to solve this problem (" ERROR: Cannot install object-detection and object-detection==0.1 because these package versions have conflicting dependencies")
what part of the process does this happen? what command did you run where this error comes up?
@@LazyTech825python -m pip install .
Thank you for kindness, I fixed the problem 👍
@@abraralharbi6835 how did you solve this error please help
@@LazyTech825 i got the same error and am not able to resolve please help
This was great, one issue which has made me pause though is CUDA. This didnt work with CUDA out of the box. I played around with cudnn, CUDA, and these commands: print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
print(tf.test.is_built_with_cuda()) Finally after following a guide i found online i was able to get the is built with cuda to return true, only issue is the number of gpu's available was stuck at 0.
Absolutely frustrating. I've spent all day getting this to work and big thanks to your tutorial for getting this far (although i still encountered about 3 issues which I had to overcome - not your fault though!), but I dont want to run tensorflow on CPU....so im thrilled to have got this far and disappointed that CUDA is such a pain in the ass to get working.
If you could come out with another guide to replace your last 25min video on setting this up, or a way to get it working once its been setup, that would be incredible. I have tried changing cuda versions, using tensorflow-gpu, changing cudnn to align with the cuda versions, and more...
Absolute pain in the ass to get working.
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [62 lines of output] i am getting this error can you please tell what can be the fix ?
Got the same issue. Before running setup.py, I installed Cython with a version
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
I got this error whenever I try to install the setup python program. is there a way to fix this issue?
Try running 'pip install pycocotools' - if that doesn't work try 'pip install git+github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI'
@@LazyTech825 I tried to do this, but i got this error "Cannot unpack file" and "cannot detect archive format" and "ERROR: Cannot determine archive format"
Hey, thanks a lot for your video.
I have a small question, would it be possible to install TF2 as shown here in the video also on a Raspberry Pi 4 with 8GB ? Does anyone have experience with this ?
Thanks for the help
I believe you’ll have to use tflite, which is a version of tensorflow made for mobile and small devices - thinking of making a video about this
There are lot of compatibility issues !
Merci beaucoup c est super
python -m pip install while doing this one i got a error that, ignored following bcause of different python version
You can probably do it with a different python version
For future people I have yet to see or hear of anyone who got object detection working with any python newer than 3.9.x.
could you please increase the font size on cmd, struggled with most commands
Thank you for letting me know! I will zoom in next time
@@LazyTech825 but cool vid, gthank you so much
You should use a larger font size when making videos, 720 quality is still very blurry
does this work on raspberry pi 4?
Checkout my video for tensorflow lite on raspberry pi
@@LazyTech825 yes i tried to use it,but it gives me an error, there's no web camera,i use raspberry pi 4 ,os 64 bit,bookworm,with pi camera module 3
thankyou!
thank you
C:\Users\MATSTRIX\anaconda3\envs\tf2\python.exe: can't open file 'C:\Users\MATSTRIX\Projects\tf2\detect_from_images.py': [Errno 2] No such file or directory
i'm literally stuck for days in this error.
its showing git is not recognised as a command
what to do?
Do you have git installed?
@@LazyTech825 no i didnt but now i did and its working thankss
also in the test one it shows absl modulenotfounderror
I have this one as well, did you ever get to fixing it?
Can I do all of this without anaconda ?
You can, but it might be harder to do
@@LazyTech825 Thank you sir, can I ask u some question next time for my project
is trhere anyone who could do the second part in macOS
HOW! PYTHON DOESN"T UNDERSTAND, where it is located
(tf_py37) C:\Users\Sarvar\Desktop\ODAPI\models
esearch\object_detection>python detect_from_image.py -m ssd_mobilenet_v2_320x320_coco17_tpu-8\saved_model -l .\data\mscoco_label_map.pbtxt -i .\test_images
Traceback (most recent call last):
File "detect_from_image.py", line 10, in
from object_detection.utils import ops as utils_ops
ModuleNotFoundError: No module named 'object_detection'
try this.. python .\detect_from_image.py -m .\ssd_mobilenet_v2_320x320_coco17_tpu-8\saved_model -l ..\.\data\mscoco_label_map.pbtxt -i ..\.\test_images
generally this is due to the argument pointing to a different location. see the difference in directories between where the py file is and the labemap and test images are.
i am executing that command from this location in my terminal: \Tensorflow\models
esearch\object_detection\utils>
my directory structure is like this:
object_detection
| - data
| | - mscoco_label_map.pbtxt
| - test_images
| - utils
| | - ssd_mobilenet_v2_320x320_coco17_tpu-8
| | | - saved_model
| | | - checkpoint
| | - ssd_mobilenet_v2_320x320_coco17_tpu-8.tar.gz
| | - detect_from_image.py
| | - model_downloader.py
@@BharadwajChukkala i tried it , but it doesn't work, does it work with you totally?
Yes
Depends on the trees structure u have. Send a git link to ur code and i’ll take a look at it.
@@comicnerd9770 thank you , i restarted everything from the beginning and it's solved now
PLEASE HELP , STUCK AT THIS FOR 2 DAYS .........................................
Collecting pyyaml=5.1 (from tf-models-official>=2.5.1->object-detection==0.1)
Using cached PyYAML-5.4.1.tar.gz (175 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
Getting requirements to build wheel did not run successfully.
exit code: 1
i got the same error. did you find any solution, beacuse I really can use the help
I also have the same error:( have you find the solution yet??
Got the same issue. Before running setup.py, I installed Cython with a version
@@RajarshiBangal
Got the same issue. Before running setup.py, I installed Cython with a version
anyone get error in13min.
error - WARNING:tensorflow:From C:\Users\DK\.conda\envs\tf2\Lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.
just watched this tutorial and encountered "ImportError: cannot import name 'builder' from 'google.protobuf.internal'". can i get a fix?
add protobuf to path variable
Goodluck if you have an M1 chip, no training for you. Getting " contrib" does not exist at the testing stage because apparently TF2 does not have a tf.contrib equivalent. docs.google.com/spreadsheets/d/1FLFJLzg7WNP6JHODX5q8BDgptKafq_slHpnHVbJIteQ/edit#gid=0