Skip to content

Return predictions as json #2703

@robmarkcole

Description

@robmarkcole

🚀 Feature

For creating API around models it would be very useful to add a to_json() method for inference results on class Detections.

Motivation

Creating a flask app to expose inferencing, will need to implement a to_json() method but preferable to wrap around a standardised result.

Pitch

Ideally something like:

detections = model(img, size=640)
return jsonify({"detections": detections.to_json()})

Additional context

Can be used in #2662

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions