What is the use of imgsz in inference on Yolov8 model ?
Looking at current documentation's example, we can write :
model.predict(source, save=True, imgsz=320, conf=0.5)
(https://docs.ultralytics.com/modes/predict/#inference-sources).
It is not documented as argument, but can be passed.
Can it differ from the value used in training ?
It can differ from the training value, but you will get better inference performance on the same image size as used for the training. More precisely, if the object size in inference mode will be the same as the one the model was trained on. As I understand, the default value of 'imgsz' argument for inference is taken from the model object and will be the same as used for model training. You can change it depending on your needs, for example, a smaller image size in inference mode can give you faster inference. A single integer value will mean that images will be resized having a larger dimension equal to this integer (divisible by 32). Also, only for inference, you can pass two values for image height and width, for example, imgsz=[384,640].