TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 | TensorFlow Object Detection Classifier for multiple object | Machine Learning library
kandi X-RAY | TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 Summary
kandi X-RAY | TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 Summary
The purpose of this tutorial is to explain how to train your own convolutional neural network object detection classifier for multiple objects, starting from scratch. At the end of this tutorial, you will have a program that can identify and draw boxes around specific objects in pictures, videos, or in a webcam feed. There are several good tutorials available for how to use TensorFlow’s Object Detection API to train a classifier for a single object. However, these usually assume you are using a Linux operating system. If you’re like me, you might be a little hesitant to install Linux on your high-powered gaming PC that has the sweet graphics card you’re using to train a classifier. The Object Detection API seems to have been developed on a Linux-based OS. To set up TensorFlow to train a model on Windows, there are several workarounds that need to be used in place of commands that would work fine on Linux. Also, this tutorial provides instructions for training a classifier that can detect multiple objects, not just one. The tutorial is written for Windows 10, and it will also work for Windows 7 and 8. The general procedure can also be used for Linux operating systems, but file paths and package installation commands will need to change accordingly. I used TensorFlow-GPU v1.5 while writing the initial version of this tutorial, but it will likely work for future versions of TensorFlow. TensorFlow-GPU allows your PC to use the video card to provide extra processing power while training, so it will be used for this tutorial. In my experience, using TensorFlow-GPU instead of regular TensorFlow reduces training time by a factor of about 8 (3 hours to train instead of 24 hours). The CPU-only version of TensorFlow can also be used for this tutorial, but it will take longer. If you use CPU-only TensorFlow, you do not need to install CUDA and cuDNN in Step 1.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Create a tf example
- Convert a class label text to an integer
- Convert xml file to csv
- Split a Pandas DataFrame
TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 Key Features
TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 Examples and Code Snippets
object_name = labels[int(classes[i])] # Look up object name from "labels" array using class index
if object_name == 'person':
#see what the difference in centroids is after every x frames to determine direction of movement and tally up total numbe
Community Discussions
Trending Discussions on TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
QUESTION
I am following this tutorial https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10.
System - Windows 10, Anaconda Prompt, Python 3.6, tensorflow 1.15.0
Initial setup and training are successful. Upon pausing the training and resuming I get the error message from the title. Any help would be greatly appreciated.
...ANSWER
Answered 2022-Feb-13 at 12:52I realized that every time I reenter the environment from the anaconda prompt I should reset the python path. This solved the problem:
set PYTHONPATH=C:\tensorflow1\models;C:\tensorflow1\models\research;C:\tensorflow1\models\research\slim
QUESTION
I used the Tensorflow Object Detection API (TF1) and created a file of frozen_inference_graph.pb of Faster R-CNN. After that, I was able to apply object detection to the image using "Object_detection_image.py" in the GitHub repository below.
EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
When I use this code, how large is the input size of images to Faster R-CNN? I set both "min_dimension" and "max_dimension" of "image_resizer {" in the config file to 768. When I perform object detection, is the input size of images to Faster R-CNN automatically resized to this size? The size of my images I prepared is 1920 x 1080 pixels, and I think it has been resized to 768 x 768 pixels.
If anyone knows about this, please let me know.
Thank you!
...ANSWER
Answered 2021-Jan-21 at 06:43Assuming you're using Object_detection_image.py
you can modify the code to print out the size of image being used:
QUESTION
I'm was to follow this https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 . I realized part way through that I was running into problems because not all of my files in the protos folder were converted to python files? So i tried to do each file separately again.
this is what i put into command prompt. it's telling me "tried to write file twice". and in the folder there is still no center_net_pb2.py file.
...ANSWER
Answered 2020-Jun-29 at 22:01You have included the input file name twice:
QUESTION
I want to use tensorflow for detecting cars in an embedded system, so I tried ssd_mobilenet_v2 and it actually did pretty well for me, except for some specific car types which are not very common and I think that is why the model does not recognize them. I have a dataset of these cases and I want to improve the model by fine-tuning it. I should also note that I need a .tflite file because I'm using tflite_runtime in python. I followed these instructions https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 and I could train the model and reached a reasonable loss value. I then used export_tflite_ssd_graph.py in the object detection API to build inference_graph from the trained model. Afterwards I used toco tool to build a .tflite file out of it.
But here is the problem, after I've done all that; not only the model did not improve, but now it does not detect any cars. I got confused and do not know what is the problem, I searched a lot and did not find any tutorial about doing what I need to do. They just added a new object to a model and then exported it, which I tried and I was successful doing that. I also tried to build a .tflite file without training the model and directly from the Tensorflow detection model zoo and it worked fine. So I think the problem has something to do with the training process. Maybe I am missing something there.
Another thing that I did not find in documents is that whether is it possible to "add" a class to the current classes of an object detection model. For example, let's assume the mobilenet ssd v2 detects 90 different object classes, I would like to add another class so that the model detects 91 different classes instead of 90 classes. As far as I understand and tested after doing transfer learning using object detection API, I could only detect the objects that I had in my dataset and the old classes will be gone. So how do I do what I explained?
...ANSWER
Answered 2020-May-17 at 12:11I found out that there is no way to 'add' a class to the previously trained classes but with providing a little amount of data of that class you can have your model detect it. The reason is that the last layer of the model changes when transfer learning is applied. In my case I labeled around 3k frames containing about 12k objects because my frames would be complicated. But for simpler tasks as I saw in tutorials 200-300 annotated images would be enough.
And for the part that the model did not detect anything it has something to do with the convert command that I used. I should have used tflite_convert
instead of toco
. I explained more here.
QUESTION
I am using tensorflow object-detection api for training a custom model using ssdlite_mobilenet_v2_coco_2018_05_09 from tensorflow model zoo.
I successfully trained the model and test it out using a script provided in this tutorial.
Here is the problem, I need a detect.tflite to use it in my target machine (an embedded system). But when I actually make a tflite out of my model, it outputs almost nothing and when it does, its a wrong detection. To make the .tflite file, I first used export_tflite_ssd_graph.py
and then toco
on the output with this command by following the doc and some google searches:
toco --graph_def_file=$OUTPUT_DIR/tflite_graph.pb --output_file=$OUTPUT_DIR/detect.tflite --input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor --output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' --allow_custom_ops
Also, the code I'm using for detection task from .tflite is working properly, as I tested it with ssd_mobilenet_v3_small_coco detect.tflite file.
...ANSWER
Answered 2020-May-17 at 12:08The problem was with the toco
command. Some documents that I used were outdated and mislead me. toco
is deprecated and I should have used tflite_convert
tool instead.
Here is the full command I used (run from your training directory):
tflite_convert --graph_def_file tflite_inference_graph/tflite_graph.pb --output_file=./detect.tflite --output_format=TFLITE --input_shapes=1,300,300,3 --input_arrays=normalized_input_image_tensor --output_arrays='TFLite_Detection_PostProcess','TFLite_Detection_PostProcess:1','TFLite_Detection_PostProcess:2','TFLite_Detection_PostProcess:3' --inference_type=QUANTIZED_UINT8 --mean_values=128 --std_dev_values=127 --change_concat_input_ranges=false --allow_custom_ops
I did the training on ssdlite_mobilenet_v2_coco_2018_05_09 model and added this at the end of my .config file.
QUESTION
HI all could someone please help me?
I want to know the rectangle coordinate
(left up and right dow) I reference this https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/blob/master/Object_detection_webcam.py
is it need to use the 'boxes'? and how let tensorflow know which is the rectangle coordinate?
is the following right? and is it need to be int? x_left = 1280*(np.squeeze(boxes[0,0,1]))
y_left = 640 *(np.squeeze(boxes[0,0,0]))
x_right = 1280*(np.squeeze(boxes[0,0,3]))
y_right = 640 *(np.squeeze(boxes[0,0,2])) ------------------------------------------------------------------is it need to be int?
x_left = int(round(x_left))
y_left = int(round(y_left))
x_right= int(round(x_right))
y_right= #int(round(y_right))
...ANSWER
Answered 2020-Apr-27 at 11:32boxes
is an array of normalized coordinates. The length of the boxes
array is equal to the number of detection. For index i
,
QUESTION
I trained a custom model that can find custom objects in the image. I used a terrific article
Many thanks to Evan EdjeElectronics.
This python code works fine:
...ANSWER
Answered 2020-Feb-07 at 10:06I solved the problem with TensorFlowSharp
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
The TensorFlow Object Detection API requires using the specific directory structure provided in its GitHub repository. It also requires several additional Python packages, specific additions to the PATH and PYTHONPATH variables, and a few extra setup commands to get everything set up to run or train an object detection model. This portion of the tutorial goes over the full set up required. It is fairly meticulous, but follow the instructions closely, because improper setup can cause unwieldy errors down the road. Create a folder directly in C: and name it “tensorflow1”. This working directory will contain the full TensorFlow object detection framework, as well as your training images, training data, trained classifier, configuration files, and everything else needed for the object detection classifier. Download the full TensorFlow object detection repository located at https://github.com/tensorflow/models by clicking the “Clone or Download” button and downloading the zip file. Open the downloaded zip file and extract the “models-master” folder directly into the C:\tensorflow1 directory you just created. Rename “models-master” to just “models”. If you are using an older version of TensorFlow, here is a table showing which GitHub commit of the repository you should use. I generated this by going to the release branches for the models repository and getting the commit before the last commit for the branch. (They remove the research folder as the last commit before they create the official version release.). This tutorial was originally done using TensorFlow v1.5 and this GitHub commit of the TensorFlow Object Detection API. If portions of this tutorial do not work, it may be necessary to install TensorFlow v1.5 and use this exact commit rather than the most up-to-date version. TensorFlow provides several object detection models (pre-trained classifiers with specific neural network architectures) in its model zoo. Some models (such as the SSD-MobileNet model) have an architecture that allows for faster detection but with less accuracy, while some models (such as the Faster-RCNN model) give slower detection but with more accuracy. I initially started with the SSD-MobileNet-V1 model, but it didn’t do a very good job identifying the cards in my images. I re-trained my detector on the Faster-RCNN-Inception-V2 model, and the detection worked considerably better, but with a noticeably slower speed. You can choose which model to train your objection detection classifier on. If you are planning on using the object detector on a device with low computational power (such as a smart phone or Raspberry Pi), use the SDD-MobileNet model. If you will be running your detector on a decently powered laptop or desktop PC, use one of the RCNN models. This tutorial will use the Faster-RCNN-Inception-V2 model. Download the model here. Open the downloaded faster_rcnn_inception_v2_coco_2018_01_28.tar.gz file with a file archiver such as WinZip or 7-Zip and extract the faster_rcnn_inception_v2_coco_2018_01_28 folder to the C:\tensorflow1\models\research\object_detection folder. (Note: The model date and version will likely change in the future, but it should still work with this tutorial.). Download the full repository located on this page (scroll to the top and click Clone or Download) and extract all the contents directly into the C:\tensorflow1\models\research\object_detection directory. (You can overwrite the existing "README.md" file.) This establishes a specific directory structure that will be used for the rest of the tutorial.
All files in \object_detection\images\train and \object_detection\images\test
The “test_labels.csv” and “train_labels.csv” files in \object_detection\images
All files in \object_detection\training
All files in \object_detection\inference_graph
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page