Let me start with this :
I know nothing about the ML, DL , AI or those big buzz words you keep hearing couple of times a day. I just barely trying to scratch those huge mountains from past 2 months and cant even able to successfully do that till now. So I just know names nothing else but with a lot of optimism I'm trying to use few software or programming tools to train a pre-trained network using transfer learning with custom data.
In this blog post I will try to explain how I miserably tried and failed at training a Object detection model using custom data with NVIDIA DIGITS using DetectNet.
The total process is divided in to three steps :
There is exhaustive guide on how to setup the NVIDIA digits on the host system or using cloud : https://github.com/dusty-nv/jetson-inference
Follow it line by line , if you are lucky you can set it up and test it in two days as stated in the documents - but for me it took me almost entire week to set it up.
Possible Pitfalls :
2.Collecting and preparing the data
I'm trying to detect the (lemon) leafs in the following image
So I go to the nearby field and collected around 100 images like them using my phone. I labelled them using labelImg - that's quite a laborious work for 100 , but think about when need a couple of thousand training images.
labelImg will give us annotations as XML files in PASCAL VOC format , like this
But DIGITS needs data in KITTI format.
which is a TXT file with specific information, so i wrote a python code for converting labelImg xml files to kiiti format. you can find it in my git repo.
To use my code copy all your images into the directory and specify it in SRC_DIR and it will do the rest. The code will create directory named 'labels' and saves generated files there.
After that you need to divide that data in to train and validate as specified in the doc. You can use my another script to do that.
I know nothing about the ML, DL , AI or those big buzz words you keep hearing couple of times a day. I just barely trying to scratch those huge mountains from past 2 months and cant even able to successfully do that till now. So I just know names nothing else but with a lot of optimism I'm trying to use few software or programming tools to train a pre-trained network using transfer learning with custom data.
In this blog post I will try to explain how I miserably tried and failed at training a Object detection model using custom data with NVIDIA DIGITS using DetectNet.
The total process is divided in to three steps :
- Installing and setting up digits in system
- Collecting and preparing the data
- Training the model
There is exhaustive guide on how to setup the NVIDIA digits on the host system or using cloud : https://github.com/dusty-nv/jetson-inference
Follow it line by line , if you are lucky you can set it up and test it in two days as stated in the documents - but for me it took me almost entire week to set it up.
Possible Pitfalls :
- use DIGITS caffe documentation instead of NVIDIA caffe to install caffe. The problem i faced doing opposite is NVIDIA caffe is installed using protobuff 2.6 but protobuff 3.4.0 required for it to train DetectNet. I haven't check the image classification with this modification
- TensorFlow-GPU only supports cuda-8-0 , if you installed cuda-10.0 (latest while writing this) you have to install cuda-8-0 , to enable TensorFlow in DIGIT. Ref - https://stackoverflow.com/questions/45375981/tensorflow-importerror-libcusolver-so-8-0
2.Collecting and preparing the data
I'm trying to detect the (lemon) leafs in the following image
So I go to the nearby field and collected around 100 images like them using my phone. I labelled them using labelImg - that's quite a laborious work for 100 , but think about when need a couple of thousand training images.
labelImg will give us annotations as XML files in PASCAL VOC format , like this
<object>
<name>leaf</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>2451</xmin>
<ymin>142</ymin>
<xmax>2798</xmax>
<ymax>986</ymax>
</bndbox>
</object>
<object>
<name>leaf</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>637</xmin>
<ymin>1025</ymin>
<name>leaf</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>2451</xmin>
<ymin>142</ymin>
<xmax>2798</xmax>
<ymax>986</ymax>
</bndbox>
</object>
<object>
<name>leaf</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>637</xmin>
<ymin>1025</ymin>
But DIGITS needs data in KITTI format.
which is a TXT file with specific information, so i wrote a python code for converting labelImg xml files to kiiti format. you can find it in my git repo.
To use my code copy all your images into the directory and specify it in SRC_DIR and it will do the rest. The code will create directory named 'labels' and saves generated files there.
After that you need to divide that data in to train and validate as specified in the doc. You can use my another script to do that.
