dronefreak/VisDrone-dataset-python-toolkit

Object detection folder not found in the repo

Closed this issue · 6 comments

HI @dronefreak I am working to this code to see the results of your object detection model, (thanks for your work) but when I run the file vis-drone-faster-rcnn.py I get this error

File "vis-drone-faster-rcnn.py", line 14, in
from utils import label_map_util
File "D:\Medipol_University\ComputerVision_Lab_Things\VisDrone-dataset-python-toolkit-master\utils\label_map_util.py", line 26, in
from object_detection.protos import string_int_label_map_pb2
ModuleNotFoundError: No module named 'object_detection'

I find that there is no object detection/utils ... folder inside your repo. This error comes normally occurs when you use Tensorflow API. ....... Please help where can I get this particular folder from or is there any alternate way to read labels instead using label_map_util.py file.

Hello @sharoseali

Ahh I see. This is a very common error I believe. Please follow the instructions to compile the TF's Object Detection API through this here. This tutorial here gives a nice explanation and would solve all your issues.

https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

Thanks, @dronefreak! I solved it, by pasting the object detection folder from the Tensorflow API repo. I was looking to run your code without that folder. Another thing that I want to ask is that
1: I have to plot the accuracy of the model on the validation set. If you already did this (validating your model), then can you please share the code file?

2: I have to train a model on the Multiple Object Tracking dataset of visdrone. Can you please share the repo that you use to train your object detection model, I need it because current repostery has many problems. I will be very thankful if you help in saving my time.

Hi @sharoseali

I am sorry I did not really plot my validation losses and accuracy, but it is almost super-easy to do with TF's Object Detection API using Tensorboard. I just implemented this piece of code so that VisDrone dataset could be use TF's API.

Secondly, I can share the repository with you no issue at all. But again its the TF's Object Detection API's model directory, which might have the same issues as your previous repo, because the environment (your desktop/laptop) is still the same. Please send me your email-ID so that I can share it via GDrive. I will share and you can experiment with it.

I am leaving the instructions here for your further use:

Unzip the file and put this object_detection folder in your tensorflow/models/research directory. Replace the original folder with the new one that I am giving you.

The folder contains all the train/test images with the corresponding XML format labels. It also holds the required train.record and test.record files for training, so you need not re-create them, you can use them with any pretrained model you like.

Once you are ready, please navigate to the object_detection from your terminal and execute:
python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config. Here I have used, as you can see, Faster-RCNN_inception-V2 architecture. You can change it to whatever you need. Please do not forget to modify the config files also, if you decide to change the architecture.

Once the model is trained, quit the training and please execute from your terminal:
python3 export_inference_graph.py --input_type image_tensor --pipeline_config_path training/faster_rcnn_inception_v2_pets.config --trained_checkpoint_prefix training/model.ckpt-XXXX --output_directory inference_graph, where XXXX is the last saved checkpoint in your directory.

Once the frozen model is available, just use the Object_detection_image.py, Object_detection_video.py or Object_detection_webcam.py depending upon where you want to deploy your model.

Link to my Repo - (https://drive.google.com/open?id=1tzvKStQwnpYQRcrdOSkT-dYy92Tcp1jg)

Cheers and Happy Coding!

my email address: sali@st.medipol.edu.tr
Thanks, @dronefreak for your cooperation.

Edited my previous post.
Also mailed.

Cheers!