Implement ObjectDetection support #205
Conversation
|
@guangy10 @larryliu0820 sorry for the tag, but would either of you be able to take a look at my PR? Not sure if there's a process I should have been following here 😅 |
|
Optimum CI is in a rough way right now so Ill mostly just look at your new test |
|
Hey @larryliu0820 @JacobSzwejbka would you be able to take a look at my revision? Thank you! |
|
Your test is failing with what appears to be dependency issues can you take a look @benjamintli |
@JacobSzwejbka thanks for looking. the test uses detr, which has I think one way to fix this is to make the CI install executorch 1.0.0 and the dev dependencies in one line, similar to how the install_dev.py does it. Let me know what you think? |
Yeah that makes sense |
cool, I pushed a commit to modify the github actions, could you try kicking off the CI on the change? Let's see if it works 🤞 |
Summary
This PR is an attempt to implement support for ObjectDetection models in optimum ExecuTorch. This PR adds
ExecuTorchModelForObjectDetection,ObjectDetectionExportableModule, a task for object-detection, and a test for DETR type models.Notes
ObjectDetectionExportableModuletraces an object detection model, and storesnum_channels,image_size,get_label_idsandget_label_namesnum_channelsis not consistently defined in configs for the existing object detection models, so the ObjectDetectionExportableModule will try a few different config options, and if it can't resolve it it'll default to 3 (RGB), which I feel like is a sensible default. the priority goeskwargs defined num_channels -> config defined num_channels -> 3image_sizeis also not defined in configurations typically, as some models have dynamic sizes; there's not really a sensible default, since users would pick a size to use at inference/deployment time. So for this, the image size is passed in via the CLI and will only be used for object-detection modelsget_label_idsandget_label_namesare two flat lists that are used to construct id2label; for some reason executorch doesn't seem to support storing dicts as values in constant_methods (it gets flattened)ExecuTorchModelForObjectDetectionhas 3 attributes: num_channels, image_size, and id2label, which is a dict of class ids to labels.timmas a dev dependency for DETRTesting
This is my first PR in this repo, so I'm open to any feedback!