Hello AI World, choose Epochs and Batch-Size

I use pre-trained Resnet18 to train my own network.
The first test was for 150 images per class with Epochs = 100, batch-Size = 4, so I get Accuracy = 73.
The second test was for 300 images per class with Epochs = 150, batch-Size = 5, so I get less Accuracy = 61.
my question is:
How do i choose Epochs and batch-size for 300 Images to get high accuracy??

Thank you very much


You can choose any batch size just make sure it can fit into the Nano resources.

For the epochs, it depends on the image you used.
If the accuracy doesn’t meet your requirement, you can increase the number to allow more training.


Hi @AastaLLL
sorry but how to know if the batch size can fit into the Nano resources?

and what do you mean, that the epochs depends on the image I used? do you mean, that The epochs depend on the number of images I use??

Tahnk you very much

I think he mean that Jetson has a limited capacity for computing (it can barely run YOLO, best to use miniYOLO), anyway it is recommended to train first in PC and then use the result in Jetson, train on Jetson makes no sense (unless you want to do an “online” implementation, training while detecting).

Epochs usually overfit around 10to100, it depends very much on dataset, but 300 images is really few, augment data to X8 or so, then use around 5 epochs, not much more because it is really few data, for batch I recommend a multiple of your classes, from around 2 to your number of classes, it is suppossed less is better but not less than 2-3.

Hi @lmunoz ,

It is better to train my Network first in PC then convert the result in ONNX-form then use it in Jetson nano, or??

I will try to have more Images to get a better Accuracy
Thank you very much.

Well, in fact the results training in PCvsJetson should be similar, but Jetson is intended for using it for detecting purposes as if you try to train with it, you could have to wait much more than using a computer.
For data augmentation you could try to do mirror effect, and if it is an item that could be upside-down, also rotations (X4, plus mirror, X8).

Also try to find out how to use a pretrained model, and pass the training images at 224X224 size (or the recommended one for that pretrained), highly recommended.

Hi @lmunoz ,
Ok i will try it.

Thank you very much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.