Jetson Orin - Training the object detection model with my own dataset and the given Open_images dataset

Greetings Sir,

with your guidance, I have successfully trained the RESNET with the plant dataset and also my own dataset.
Now I am working on testing the object detection with the Open_images dataset as given in this tutorial and then later with my own dataset again

https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-ssd.md

But at these steps i am having a trouble. Could you please help me resolve it, sir.

at https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-ssd.md#setup

$ wget https://nvidia.box.com/shared/static/djf5w54rjvpqocsiztzaandq1m3avr7c.pth -O models/mobilenet-v1-ssd-mp-0_675.pth
$ pip3 install -v -r requirements.txt

The above 2 commands show errors respectively.

Hence tried, only the
$ wget https://nvidia.box.com/shared/static/djf5w54rjvpqocsiztzaandq1m3avr7c.pth

Later went with the step: (Open Images V6 - Download)
wget https://raw.githubusercontent.com/openimages/dataset/master/downloader.py

and then,
$ python3 downloader.py --class-names "Apple,Orange,Banana,Strawberry,Grape,Pear,Pineapple,Watermelon" --data=data/fruit

and the result is as in the picture.

Could you please tell me where am i going wrong.

Thank you sir,
Karishma

Hi @karishmathumu, when you cloned the repo with git, did you use the --recursive option? I suspect that you are missing the detection/ssd submodule, and those files aren’t on your disk yet.

If you didn’t use --recursive, try doing this:

cd /path/to/your/jetson-inference
git submodule update --init

Hai Sir,

Thank your response. I am sorry, I missed the --recursive option while cloning.
And as you said, I went into the jetson-inference path and ran “git submodule update --init” and
then went into the detection/ssd path and ran

$ wget https://nvidia.box.com/shared/static/djf5w54rjvpqocsiztzaandq1m3avr7c.pth -O models/mobilenet-v1-ssd-mp-0_675.pth
$ pip3 install -v -r requirements.txt

but the error keeps appearing, Sir.

Should I have to redo the jetson-inference with the -recursive option sir?

Regards,
Karishma.

Yes at this point I would try re-cloning the repo with --recursive, thanks.

Hai Sir,

Sorry Sir, I am not sure how to re-clone the existing jetson-inference directory in my workspace.

So, I tried to clone it from the start with the --recursive flag in a new workspace folder.
But when i do the make step while compiling the project, i am getting an error.
tk1_ws/jetson-inference/build$ make

This error is also repeating when i just doing the make in the old path-
tk_ws/src/jetson-inference/build $ make

is it an issue or can it be ignored Sir?

Regards,
Karishma

Hi @karishmathumu, this is a different error, it appears that it can’t find the CUDA Toolkit on your system. Can you do the following?

ls -ll /usr/local/cuda
/usr/local/cuda/bin/nvcc --version

If you don’t have CUDA Toolkit installed, you can install it with sudo apt-get install cuda-toolkit-*

If you have gotten the system into an unknown state with the symbolic links, I would just re-flash the device. I think the YOLO issues are probably related to the same thing.

Hai Sir,

Here is the result of the commands, you told me to run

Would re-flashing the system mean to restart the Orin, Sir?

Regards,
Karishma

I think you have created circular symbolic links somehow. What does ls -ll /usr/local/cuda-11.4 show?

If that has the CUDA toolkit in it, try removing your /usr/local/cuda link and pointing it to the correct location:

sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-11.4 /usr/local/cuda

Hai Sir,

:~$ ls -ll /usr/local/cuda

result: lrwxrwxrwx 1 root root 26 Okt 11 09:20 /usr/local/cuda → /usr/local/cuda/cuda-11.4/

:~$ ls -ll /usr/local/cuda-11.4

result: total 112
drwxr-xr-x 3 root root 4096 Aug 29 07:30 bin
drwxr-xr-x 4 root root 4096 Aug 29 07:28 compute-sanitizer
-rw-r–r-- 1 root root 160 Mai 4 09:38 DOCS
-rw-r–r-- 1 root root 61727 Mai 4 09:38 EULA.txt
drwxr-xr-x 4 root root 4096 Aug 1 08:36 extras
lrwxrwxrwx 1 root root 29 Nov 15 2021 include → targets/aarch64-linux/include
lrwxrwxrwx 1 root root 25 Nov 15 2021 lib64 → targets/aarch64-linux/lib
drwxr-xr-x 3 root root 4096 Aug 1 08:36 nvml
drwxr-xr-x 7 root root 4096 Aug 1 08:33 nvvm
-rw-r–r-- 1 root root 524 Mai 4 09:38 README
drwxr-xr-x 11 root root 4096 Aug 29 07:30 samples
drwxr-xr-x 3 root root 4096 Aug 1 08:36 share
drwxr-xr-x 3 root root 4096 Aug 1 08:32 targets
drwxr-xr-x 2 root root 4096 Aug 29 07:28 tools
-rw-r–r-- 1 root root 2127 Mai 31 09:36 version.json

:~$ /usr/local/cuda/bin/nvcc --version
result: -bash: /usr/local/cuda/bin/nvcc: Too many levels of symbolic links

now shall i run these two commands, Sir.

sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-11.4 /usr/local/cuda

Thank you very much.

Regards,
Karishma

Greeting Sir,

I deleted the ssd folder
and ran $ git submodule update --init --recursive
and then ran make, which still shows the same error of

but then I proceeded with these following commands, and successfully, the 5600 images are now downloaded.

$ wget https://nvidia.box.com/shared/static/djf5w54rjvpqocsiztzaandq1m3avr7c.pth -O models/mobilenet-v1-ssd-mp-0_675.pth
$ pip3 install -v -r requirements.txt
$ python3 open_images_downloader.py --class-names "Apple,Orange,Banana,Strawberry,Grape,Pear,Pineapple,Watermelon" --data=data/fruit

Thank you very much sir.

OK gotcha - glad you were able to get the thing with your CUDA Toolkit figure out.

If you are still having problems compiling jetson-inference, I would recommend re-cloning the repo with --recursive (although I don’t see what the error was from your screenshot, so not exactly sure). You probably want to save your data from jetson-inference/python/training/detection/ssd/data/fruits so that you don’t have to download it again.

OK, it seems like your CUDA Toolkit is good now (those were warnings, not errors)

Regarding OpenCV, it’s unclear if you have it installed or not. Can you try sudo apt-get install nvidia-opencv-dev ? And if that doesn’t work, try sudo apt-get install libopencv-dev libopencv-python python3-opencv

Hi @karishmathumu, I’m not familiar with building YOLO or darknet, so you may want to open a new topic about that if you are still having trouble. Thanks.

Greetings Sir,

Thank you very much for your patience and kindness and your fabulous solutions.

It’s been an honor to talk to you, Sir.

Regards,
Karishma.

Hi Karishma, anytime - happy to help! Glad that you were able to get it working!

Hai Sir,

I have created my own dataset with the 3 different labels using the Yolo_Label tool.
It has created a text file for each image with bouding box information.

As said, in this thread, jetson-inference/pytorch-collect-detection.md at master · dusty-nv/jetson-inference · GitHub,

i have created a folder named “samples”, data/samples and within it

  1. the folder having the images and txt files of all the images of the 3 classes.
  2. labels.txt file

Then I tried the followign command,
python3 train_ssd.py --dataset-type=voc --data=data/samples --model-dir=models/metal_can_pet_blue_transparent_pet_sleeved_images

which had an error. How do I rectify this Sir.
Do i have to segregate it into train, validation and test folders of my images?

2022-10-19 14_39_53-192.168.171.2

regards.

Is the Yolo_Label tool able to export your dataset in Pascal VOC format? The structure of Pascal VOC is what train_ssd.py expects (hence I use tools like CVAT.org that are able to export in that format)

To understand the folder structure of Pascal VOC dataset and it’s XML annotation formats, I recommend downloading a copy of the original Pascal VOC dataset from here.

Hi @karishmathumu, the error from this command says that it can’t connect to your MIPI CSI camera. Are you using a MIPI CSI camera? If not, you can run it on some test images from your dataset. See here for the different ways you can specify which data to run the detectnet program on:

https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-streaming.md

Hai Sir,

This command worked out sir.

IMAGES=<path-to-your-jetson-inference>/data/images   # substitute your jetson-inference path here

detectnet --model=models/________/ssd-mobilenet.onnx --labels=models/____/labels.txt \
          --input-blob=input_0 --output-cvg=scores --output-bbox=boxes \
            "$IMAGES/_____.jpg" $IMAGES/test/______.jpg

Finally it all worked out.

Thank you for your continuous support, Sir.

Best wishes.

Hi @karishmathumu, no problem - happy to help! Glad that you were able to get it working.