Hello AI World - now supports Python and onboard training with PyTorch!

[image] loaded ‘polar_bear.jpg’ (563x565, 3 channels)
Traceback (most recent call last):
File “reconocimiento.py”, line 23, in
net = jetson.inference.imageNet(opt.network, argv=[’–model=models/radiografia-torax/resnet18-70/resnet18.onnx’,
AttributeError: ‘Namespace’ object has no attribute ‘network’

The error to load the network

Change opt.network to args.network

parser = argparse.ArgumentParser()
parser.add_argument(“input_URI”, type=str,
help=“filename of the image to process”)
parser.add_argument("–network", type=str,
help=“learning model to use”)
args = parser.parse_args()

net = jetson.inference.imageNet(args.network, argv=[’–model=models/radiografia-torax/resnet18-70/resnet18.onnx’, ‘–labels=data/radiografia-torax/labels.txt’,
‘–input_blob=input_0’,
‘–output_blob=output_0’
])
img = jetson.utils.loadImage(args.input_URI)

I get the following
jetson.inference – imageNet.init() failed to parse args tuple
Traceback (most recent call last):
File “reconocimiento_v1.py”, line 29, in
‘–output_blob=output_0’
Exception: jetson.inference – imageNet.init() failed to parse args tuple
Change and I get the following error. What did I do wrong? @dusty_nv

Can you post your code inside <code> </code> tags so that the formatting is preserved? Because it is showing up with different characters in the browser and I’m not sure if that’s how it actually is on your source file or not.

OK, I tried this and found that you needed to specify a default argument for --network (or manually specify that on the command line), otherwise the args fail to parse and you get the exception that you were getting. Try modifying your script to reflect the below instead:

parser.add_argument("--network", type=str, default="googlenet",
                                 help="learning model to use"
                   )

OK, this means that the file 'models/radiografia-torax/resnet18-70/resnet18.onnx' could not be found from the path that you ran the script from. Can you try ls models/radiografia-torax/resnet18-70/resnet18.onnx from the same directory that you are running the script from?

1 Like

Thanks to you I have understood, very grateful @dusty_nv

One more query, can the saved images of the classification be registered in a database (MySQL, MongoDB, SQLite)?

The imagenet.py script doesn’t support this already, but you are welcome to integrate whatever SQL library you want into the Python script for doing it.

1 Like

Would you recommend a tutorial link or guide on how to use a sql library for my project?

I would recommend using sqlite3 module for Python, and it’s not really going to be different using it on Jetson than it would be on another machine - I would start here: https://docs.python.org/3/library/sqlite3.html

Can an already trained model be retrained?
I want to add images that I misclassify and retrain just those.
Or do I have to train from scratch?

Yes, if the classes are already in the model, then you can just retrain on your new dataset of misclassifications.

Note that not all the pretrained models in Hello AI World do I have the training scripts for, so this would mostly pertain to your own custom trained models.

And once the image is processed with TensorRT, how can I make it stay longer on the screen or permanently when it is executed?

Hi @rodrigoavalos, you could use a sleep() call after the image is displayed - or if you want it permanently displayed, change the inner loop of the program so that it only processes on image.

And if you want to save the output to a sequence of images, see here: https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-streaming.md#image-files