Jetson AI Fundamentals - S3E3 - Training Image Classification Models

Following the instructions that Dusty goes over in the Collecting your own Classification Dataset ( section, I get errors when running as shown in the attached file. I’m entering the command as Dusty presents it, see the attached screen picture.

Errors.docx (14.1 KB)

What am I doing wrong?


Hi Chuck, it looks like your data/tools/val folder is empty - can you copy the contents of our data/tools/train folder to it?

Also, for some reason it is picking up your Labels.txt file as a class directory for some reason. Is that actually a file and not a directory? It should be a file. If so, you might want to rename it to labels.txt to see if that makes a difference. It should not show up on this line of the script output:

=> dataset classes:  6 ['Background', 'Labels.txt', 'flashlight', 'hammer', 'pliers', 'screwdriver']

If you still have problems, you can upload your dataset to Google Drive or somewhere, and I can take a look. Thanks.


I got the Labels.txt directory deleted and will work on copying the data/tools/train tomorrow. I’m used to doing this on a Mac and PC using a mouse, but need to learn how from a terminal, unless there is someway in Ubuntu?


Do you have a display connected to your Jetson? If so, you can open the File Browser in Ubuntu and move the files that way.

Otherwise, these should be the commands from the terminal to do it:

$ cd /path/to/your/jetson-inference/python/training/classification/data
$ cp -r tools tools_backup     # make a backup of your original first :)
$ cp -r tools/train tools/val


Thanks for the reply. I didn’t have permission to copy anything into the folders, although I could copy to the desktop as an example. I think my folders all got hosed up, so I’m starting from scratch, ie flashed a new image of Jetpack. I’ll let you know how it goes.


If you were using the jetson-inference container, it can create folders that require sudo permissions to modify from outside the container. So you can run the copy (cp) terminal commands with sudo (i.e. sudo cp -r tools/train tools/val)


Thanks for the help, I got it working. The new SD card image worked much better. Some of my objects had +99 ratings.

I could use just a little help with this. I’m sure I’m doing something wrong, I’m a rookie at this stuff.
sudo fallocate -l 4G /mnt/4GB.swap
sudo mkswap /mnt/4GB.swap
sudo swapon /mnt/4GB.swap

/mnt/4GB.swap none swap sw 0 0

The first three commands work just fine. However when entering the last one to make it permanent it gives this error message:
bash: /mnt/4GB.swap: Permission denied


Hi Chuck, glad you got it working. So /mnt/4GB.swap none swap sw 0 0 is meant to be added to the end of your /etc/fstab. You can do that in a text editor - the Nano editor is easy to use:

$ sudo apt-get install nano
$ sudo nano /etc/fstab
# scroll down add add this line to the bottom:   /mnt/4GB.swap none swap sw 0 0
# Press Ctrl+o to save, then Ctrl+x to exit
$ sudo reboot

After rebooting, if you run tegrastats, you should see at least 4096MB of SWAP memory listed.


Thanks again, got it working.