Skip to content

Instantly share code, notes, and snippets.

@CFIALeronB
Last active February 20, 2024 21:04
Show Gist options
  • Save CFIALeronB/f613cc632610ed93e267237d3832581e to your computer and use it in GitHub Desktop.
Save CFIALeronB/f613cc632610ed93e267237d3832581e to your computer and use it in GitHub Desktop.
Feature Request: Display Top 5 Classification Classes in Nachet Frontend

Feature Request: Display Top 5 Classification Classes in Nachet Frontend

Summary

Enhance the Nachet Frontend to display the top 5 classification classes returned by the Nachet Backend. This feature will allow users to click on one of the top classes and view the seed classification results correlated with their selection.

Background

The current implementation of image classification in Nachet Frontend supports returning results from a single class, specifically for seed classification. The classification process utilizes an AI model trained on various classes to identify the type of seeds present in an image. As part of our continuous effort to improve user experience and functionality, there is a need to expand this feature.

Objective

  • Implement the display of the top 5 classification classes returned from the Nachet Backend in the Nachet Frontend interface.
  • Enable user interaction with these classes to view detailed seed classification results associated with each class.

Requirements

  • Frontend Display: Modify the UI to include a section or component that lists the top 5 classification classes as returned by the backend.
  • User Interaction: Implement functionality allowing users to click on a class and be presented with the corresponding seed classification results.
  • Data Handling: Ensure the frontend correctly handles and displays the data for the top 5 classes, including any metadata necessary for user comprehension.
  • Backend Integration: Coordinate with backend services to consume the necessary endpoints or data formats required for retrieving the top 5 classes and their related results.

User Stories

  • As a user, I want to see the top 5 classes of seed classification so that I can understand the variety and scope of the classifications.
  • As a user, I want to select a class from the top 5 displayed to view detailed classification results for that class, enhancing my ability to analyze and interpret the data.

Acceptance Criteria

  • The frontend displays a list or section showcasing the top 5 classification classes received from the backend.
  • Users can interact with the list of classes to view detailed results for each class.
  • The system gracefully handles scenarios where fewer than 5 classes are available or when data fetching encounters issues.
  • The UI and data presentation are intuitive and align with existing design principles of the Nachet Frontend.

Implementation Considerations

  • Consider the most effective UI component or layout to represent the top 5 classes and their selection mechanism.
  • Ensure compatibility and seamless integration with existing frontend components and backend data structures.
  • Prioritize performance and responsiveness, particularly in data fetching and UI updates.

This feature is aimed at broadening the analytical capabilities available to users, providing deeper insights into the seed classification process, and enhancing the overall usability of the Nachet Frontend.

@MaxenceGui
Copy link

I will add this to the Nachet backend docs shortly,

Currently, the inference request returns a JSON containing a list with the following keys:

  • boxes - Key containing all the boxes
    • box - key containing the dimensions of a box around the seeds
    • label - top label prediction
    • score - top confidence level
    • overlapping - indicate if two boxes overlap
    • overlappingIndices - indicate the index of the box it overlap (Need to validate)
  • totalBoxes - total number of boxes

To add the top 5 predictions, the backend will use the topResult (or any other name that makes sense) key that will contain the following structure :

[
    {
      "score": 0.9985617995262146,
      "label": "14 Ambrosia psilostachya"
    },
    {
      "score": 0.0007070279098115861,
      "label": "12 Ambrosia artemisiifolia"
    },
    {
      "score": 0.0003970953112002462,
      "label": "11 Solanum rostratum"
    },
    {
      "score": 0.00019808701472356915,
      "label": "10 Solanum nigrum"
    },
    {
      "score": 6.389082409441471e-05,
      "label": "9 Solanum carolinense"
    }
]

So now the key structure will look like this:

  • boxes
    • box
    • label
    • score
    • topResult <-
    • overlapping
    • overlappingIndices
  • totalBoxes

Seed Group Notes

We've told Taran and Liang that we would change the threshold bar to switch to the top five results. They understand its purpose for training, but at the end of the day, they care about the top result and they seem doubtful about this feature's plus value.

After a few explanations from Amir, they seem to adopt the idea that it would be helpful to flag mistakes or misclassifications from the AI. The final suggestion was that when clicking on a specific seed, a component would pop up and display the top n results and if the correct answers are not there, they can click on a button to escalate the issue. (Thinking out loud, could it create automatically a GitHub issue?)


Let me know if this makes sense to you 😶

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