Skip to content

RandomCrop does nothing at validation/inference #21868

@ma7555

Description

@ma7555

The RandomCrop layer does absolutely nothing during validation. This is due to the if condition placed here:

This looks pretty odd as the validation split will have different shape from the training data. The logic seemed to be it should do center crop for training=False as it is calculated here:

Example of training with 512x512 images but doing random crop to 256x512 confirms this as it raises this error as soon as the epoch finishes.

Input 0 of layer "convnext_small" is incompatible with the layer: expected shape=(None, 256, 512, 3), found shape=(None, 512, 512, 3) Arguments received by Functional.call(): • inputs=tf.Tensor(shape=(None, 512, 512, 3), dtype=float32) • training=False • mask=None • kwargs=<class 'inspect._empty'> 

Please confirm if this is an intended behaviour that you must place a center crop layer with the same crop size just after it to maintain the pipeline?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions