Can we export a trained YOLOv4 models with different output_width x output_height than the ones it was trained with?

We have trained a YOLOv4 model with TAO, successfully exported it to .etlt and then to tensorRT .engine. We can perform inference with the models successfully.

We have set augmentation_config in training configuration as follows:

augmentation_config {
  hue: 0.1
  saturation: 1.5
  exposure: 1.5
  vertical_flip: 0
  horizontal_flip: 0.5
  jitter: 0.3
  output_width: 416
  output_height: 416
  output_channel: 3
  randomize_input_shape_period: 10
  mosaic_prob: 0.5
  mosaic_min_ratio: 0.2

so when we export the model, it is exported with dimensions -1x3x416x416. My question is, is it possible to export the model with different output_width x output_height than the one it was trained with (ex: -1x3x608x608) given we have set randomize_input_shape_period to a non-zero value.

In other words, what I am asking is setting randomize_input_shape_period equivalent to setting random=1 configuration in Darknet YOLO? .For example, with this setting, in Darknet YOLO, if the model was trained for width x height = 416x416, we can load this model as model with width x height = 608x608 and get better accuracies, or can load weights with lower width x height and will receiver faster inference, but with a reduction in accuracy.


• Network Type - Yolo_v4


The batch interval to randomly change the output width and height. For value K, the augmentation pipeline will adjust output shape per K batches, and the adjusted output width/height will be within 0.6 to 1.5 times of the base width/height.

Actually it can. You can set different output_width or output_height in the spec file.
Then run export.
yolo_v4 export -m xxx.tlt -k key -o xxx.etlt -e spec.txt --engine_file xxx.engine

1 Like

cool. thanks @Morganh