keras-cv
keras-cv copied to clipboard
Port Faster-RCNN to Backbone API
Hi,
I'm following the documentation on keras-cv website Faster-RCNN model and i can't seem to import the model. I get the below error:
I can see from the repository that Faster-RCNN seems to be in a legacy folder keras_cv/models/legacy/object_detection. How can i access this within my code as an import.
Forgive me if this is a simple question, I'm pretty new to coding in general and using repo's. I would love to do some testing with Faster-RCNN and I can see your implementation uses ROI-Align instead of pooling which is exactly what I'm looking for. I'm trying to build a custom object detector based on Faster-RCNN but with additional output branches.
Out of interest, why is this classic model marked as legacy??
Many thanks
Steve
Hey @stephentyers1975! Thanks for pointing this out. This is how you'll need to implement the code:
retina_net = keras_cv.models.legacy.FasterRCNN(num_classes=20, bounding_box_format="xywh", backbone=None)
The legacy models are the ones that we intend to migrate to the unified KerasNLP/KerasCV API but have not yet had the opportunity yet. Hope that helps!
Hi @ID6109, Many thanks for getting back to me quickly. That really helped. Looking through the code, I gather I can't use the pretrained weights from Imagenet or PascalVoc using the from_preset method on the legacy models?
I'll just pass like so:
retina_net = keras_cv.models.legacy.FasterRCNN(num_classes=20, bounding_box_format="xywh", backbone=keras_cv.models.ResNetBackbone.from_preset("resnet50_imagenet"))
As i've noticed from the code that it default uses resnet50 as a backbone.
Also what is the best place for me to ask "How to" type questions?? Is it in the discussions? Many thanks again Steve
@stephentyers1975 I think FasterRCNN needs to be migrated before you have a good experience. You cannot use migrated (non-legacy) backbones with a non-legacy model. We just keep the legacy models around as a reminder to migrate.
@jbischof Sorry I'm a bit confused, did you mean i can't use migrated (non-legacy) backbones with a legacy model? If I look at the legacy model code for Faster RCNN it seems to do just that:
self.backbone = backbone or keras_cv.models.ResNet50Backbone()
OR did you mean I can't use the preset backbone "resnet50_imagenet"
Any ETA on migrating Faster RCNN ?
Many thanks Steve
@stephentyers1975 it looks like we've updated the model to use migrated backbones, great!
We don't have a timeline for migration but if you're interested it would have huge impact.
@jbischof Thanks for the reply. Once my Python and TensorFlow skills are better I would definitely consider helping move this model. I'm a bit of a newbie if I’m honest, but I’m getting there.
Renaming this issue to reflect that FasterRCNN needs to be ported.