Skip to content

When trying to train FasterRCnn network get an error TypeError if the batch size is not specified. #2503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
odinsbane opened this issue Nov 8, 2024 · 2 comments
Assignees

Comments

@odinsbane
Copy link

odinsbane commented Nov 8, 2024

When I attempt train an FasterRCNN network I get the follow error if the batch size is not specified.

TypeError: Expected int32 passed to parameter 'y' of op 'Mul', got 0.25 of type 'float' instead. Error: Expected int32, but got 0.25 of type 'float'.

Expected Behavior:

The network should begin training.

Steps To Reproduce:

import keras_cv, keras, numpy

if __name__=="__main__":
    backbone = keras_cv.models.ResNet50V2Backbone(input_shape=(64, 64, 3))
    model = keras_cv.models.FasterRCNN( backbone, 1,  "xyxy", num_max_decoder_detections=128)
    model.compile(
        box_loss="Huber",
        rpn_classification_loss = keras.losses.BinaryCrossentropy(from_logits=True),
        rpn_box_loss = "Huber",
        optimizer=keras.optimizers.Adam(learning_rate=1e-6),
        classification_loss=keras.losses.BinaryCrossentropy(from_logits=True),
    )
    images = numpy.random.random( (8, 64, 64, 3) )
    boxes = numpy.random.random( (8, 8, 4) )
    classes = numpy.random.random( (8, 8) )
    
    model.fit(images, {"boxes":boxes, "classes" : classes})

Work around:

Specify the batch_size when calling fit and the program runs fine.

Version:

keras-cv-nightly==0.10.0.dev2024100303

@sachinprasadhs
Copy link
Collaborator

@sineeli

@sachinprasadhs sachinprasadhs added the type:Bug Something isn't working label Dec 12, 2024
@sachinprasadhs
Copy link
Collaborator

Thanks for reporting the issue! We have consolidated the development of KerasCV into the new KerasHub package, which supports image, text, and multi-modal models. Please read the announcement. KerasHub will support all the core functionality of KerasCV.

KerasHub can be installed with !pip install -U keras-hub. Documentation and guides are available at keras.io/keras_hub.

With our focus shifted to KerasHub, we are not planning any further development or releases in KerasCV. If you encounter a KerasCV feature that is missing from KerasHub, or would like to propose an addition to the library, please file an issue with KerasHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants