Skip to content
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

[feat] Add prediction values to evaluation summary #600

Merged
merged 21 commits into from
Feb 12, 2025

Conversation

hglee98
Copy link
Contributor

@hglee98 hglee98 commented Dec 18, 2024

Description

This PR aims to add functionality that converts the model's prediction values into a dictionary format and stores them in the predictions.json. In this PR, prediction values have been added for Classification, Segmentation and Detection tasks as follows:

Object Detection

{
    "predictions":
        [
            {
                "bboxes":
                [
                    {
                        "class": int,
                        "name": str,
                        "confidence_score": float,
                        "coords": {
                            "x1": int,
                            "y1": int,
                            "x2": int,
                            "y2": int
                        }
                    },
                    ...
                ]
                "shape":
                {
                    "width": int,
                    "height": int
                }
            }
        ]
}

Classification

{
    "predictions":
        [
            "class": int,
            "name": str,
            "shape": {
                "width": int,
                "height": int
            }
        ]
}

Segmentation

{
    "predictions":
        [
            {
                "segmentation":
                [
                    {
                        "class": int,
                        "name": str,
                        "polygon": list
                    },
                    ...
                ]
                "shape":
                {
                    "width": int,
                    "height": int
                }
            }
        ]
}
    

This feature is not supported on pose-estimation tasks yet.

Related to #599

Change(s)

  • Add prediction values for Detection task which includes bounding boxes with class, name, confidence score, and coordinates
  • Add prediction values for Classification task which includes class, name, and shape information
  • Store predictions in dictionary format in the model summary
  • Convert segmentation mask to polygon format when saving predictions artifacts
  • No implementation for pose-estimation task in this PR

Code Formatting

If you PR to either master or dev branch, you should follow the code linting process. Please check your code with lint_check.sh in ./scripts directory.
For more information, please read the contribution guide in CONTRIBUTING.md.

Changelog

If your PR is granted to dev branch, codeowner will add a brief summary of the change to the Upcoming Release section of the CHANGELOG.md file including a link to the PR (formatted in markdown) and a link to your github profile.

For example,

- Added a new feature by `@myusername` in [PR 2023](https://github.com/Nota-NetsPresso/netspresso-trainer/pull/2023)

Please enable Allow edits and access to secrets by maintainers so that our maintainers can update the CHANGELOG.md.

@hglee98 hglee98 requested a review from illian01 as a code owner December 18, 2024 03:51
@hglee98 hglee98 marked this pull request as draft December 20, 2024 06:47
@hglee98 hglee98 changed the title [feat] Add prediction values to evaluation summary for Detection and Classification tasks [feat] Add prediction values to evaluation summary Jan 9, 2025
@hglee98 hglee98 marked this pull request as ready for review January 9, 2025 04:31
@illian01
Copy link
Collaborator

Seems predictions are stored in list.
But I think this makes hard to know which is the original input image of the prediction.
How about store it in dict[image_name: prediction]? For example,

{
    "predictions": {
        "test_image.png": {
            "class": int,
            "name": str,
            "shape": {
                "width": int,
                "height": int
            }
        }
    }
}

Copy link
Collaborator

@illian01 illian01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Please add original image info later.

@illian01 illian01 added the enhancement New feature or request label Feb 12, 2025
@illian01 illian01 merged commit 1bbbcdd into Nota-NetsPresso:dev Feb 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants