Persistent error: crop size greater than the image size.

Hi there, I am attempting to compile the backbone of some trained resnet50 weights:

hailomz compile resnet_v1_50 --ckpt=resnet50_backbone.onnx --hw-arch hailo8 --start-node-names /backbone/conv1/Conv --end-node-names /backbone/avgpool/GlobalAveragePool --performance.

This of course excludes the calibration set. However with this command, with a path to jgg files or a path to tfrecord, I get a persistent error on the calibration which makes me think it may not be to do with the images… I have tried only including large images (above 700x700), using smaller datasets <640 and using -resize.

Here is the error.

raise core._status_to_exception(e) from None # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node _wrapped__ReduceDataset_Targuments_0_Tstate_1_output_types_1_device/job:localhost/replica:0/task:0/device:CPU:0}} assertion failed: [Crop size greater than the image size.]
[[{{node Assert_1/Assert}}]] [Op:ReduceDataset]

Any help please?

Hey @Orlando_Closs,

Welcome to the Hailo Community!

To help diagnose what’s going wrong, can you start by running the parsing command first? The parsing step usually gives more detailed info about what’s failing during the initial model compilation—it can pinpoint the problem much faster.


What’s Actually Happening?

The error:

assertion failed: [Crop size greater than the image size.]

comes from TensorFlow’s input pipeline. Basically, it means the calibration/preprocessing step is trying to crop a patch that’s larger than at least one of your images. The issue isn’t with your original images or the Hailo compiler—it’s a mismatch between your requested crop size and the actual image dimensions.

How to Fix

  1. Check the model’s expected input size (for ResNet50, usually 224x224).

  2. Always use the --resize argument during compile, e.g.:

    --resize 224 224
    

    This keeps the pipeline from trying to crop larger than what’s there.

  3. If you’re using TFRecord:
    Double-check that no image inside is smaller than your crop size. You might need to filter out or resize small images before creating the TFRecord.


If you post the parsing command and any logs, it’ll be easier to see where the problem is and give more specific advice!