libffcv / ffcv

FFCV: Fast Forward Computer Vision (and other ML workloads!)
https://ffcv.io
Apache License 2.0
2.8k stars 180 forks source link

I think ffcv might not be suitable for object detection task #222

Open songyuc opened 2 years ago

songyuc commented 2 years ago

Hi guys, after a long time trying to apply ffcv on object detection task, I finally draw a conclusion that ffcv might not be suitable for object detection task, as,

  1. FFCV require both data types of images and targets with a fixed shapes, which is almost impossible for object detection task, because the instances number in an image is indeterminate. It is nearly IMPOSSIBLE to transform the targets into a fixed-length data type .
  2. The .beson file is SO BIG, which might occupy too much disk space.
andrewilyas commented 2 years ago

Hi! Thanks for your comment --- my only two suggestions are:

  1. Since the targets are very unlikely to be the dominating factor for either data loading time or storage space, you can always just pad the targets into an array of shape (max number of instances, 5) and then separately store a "number of instances" field. For another example of variable-length data you can check this String example: https://github.com/libffcv/ffcv/blob/b390f8e0ce6cb3396fe2c66ee4a8df451586e0ef/tests/test_custom_field.py

  2. The .beton can usually be made much smaller depending on how you write the images---if you're not already, I would suggest both resizing the images (using max_resolution=500 or something) and using JPEG encoding rather than storing the images raw. Information about how to do both of these is available in the documentation.

Let us know if you need any specific help!

songyuc commented 2 years ago

Hi! Thanks for your comment --- my only two suggestions are:

  1. Since the targets are very unlikely to be the dominating factor for either data loading time or storage space, you can always just pad the targets into an array of shape (max number of instances, 5) and then separately store a "number of instances" field. For another example of variable-length data you can check this String example: https://github.com/libffcv/ffcv/blob/b390f8e0ce6cb3396fe2c66ee4a8df451586e0ef/tests/test_custom_field.py
  2. The .beton can usually be made much smaller depending on how you write the images---if you're not already, I would suggest both resizing the images (using max_resolution=500 or something) and using JPEG encoding rather than storing the images raw. Information about how to do both of these is available in the documentation.

Let us know if you need any specific help!

I will continue trying using ffcv. Please give me some time to do more tests.