huggingface / exporters

Export Hugging Face models to Core ML and TensorFlow Lite
Apache License 2.0
622 stars 46 forks source link

Fix generate dummy image #63

Closed petrukha-ivan closed 1 year ago

petrukha-ivan commented 1 year ago

Hello! First and foremost, I want to express my gratitude for your incredible work, which has made it easier than ever to use 🤗 Transformers locally on devices. While exploring various transformers and the tasks they can perform, I noticed a discrepancy in the object detection results compared to Python inference. The issue stemmed from the fact that CoreMLConfig.generate_dummy_image generates images with dimensions that do not match the specified ones.

image_width, image_height = 512, 288
pixel_values = np.random.randint(0, 256, (image_width, image_height, 3), dtype=np.uint8)
coreml_value = Image.fromarray(pixel_values)
print(f'W:{coreml_value.width}, H:{coreml_value.height}') # W:288, H:512
petrukha-ivan commented 1 year ago

I've started from YOLOS, but will experiment with DETR soon 👍

pcuenca commented 1 year ago

Thank you!