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

Fix image by step plots with bounding boxes #5313

Closed

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Feb 19, 2024

main <- #5227 <- #5241 <- #5250 <- #5305 <- this

Fixes a bug with bounding boxes not being shown in every image in multi img plots.

@julieg18 julieg18 added the bug Something isn't working label Feb 19, 2024
@julieg18 julieg18 self-assigned this Feb 19, 2024
@julieg18 julieg18 changed the base branch from add-bb-backend-logic to improve-bounding-box-frontend February 20, 2024 00:17
@@ -94,7 +94,9 @@ export type ComparisonPlotClass = {
}

export type ComparisonPlotClasses = {
[revision: string]: { [path: string]: ComparisonPlotClass[] }
[revision: string]: {
[path: string]: { [imgInd: number]: ComparisonPlotClass[] }
Copy link
Contributor Author

@julieg18 julieg18 Feb 20, 2024

Choose a reason for hiding this comment

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

In image by step plots case, path is a directory and could hold multiple images' class coordinates. I've amended this by adding a ind key.

Another option that we could do is an nested array::

[revision: string]: { [path: string]: Array<ComparisonPlotClass[] | null>  }

But it felt like collection code would be a bit more complicated (would have to filter out created arrays that were filled with only null while keeping the ones that have at least one img with classes while ensuring we don't accidentally break the order of the imgs' classes).

Copy link
Contributor

Choose a reason for hiding this comment

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

You know the context better than I do, so don't change it if it doesn't make sense or if it's still more complicated, but would using an empty array instead of null make thing simpler? So:

[revision: string]: { [path: string]: ComparisonPlotClass[][] }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using an empty array to represent an image that has no classes is doable and I'm happy to change if it benefits code simplicity or code optimization! But we would still face the same issue of needing to add an extra check for seeing if an array is just filled with empty arrays...

Though now that I look over this code again, I think the check would be doable without adding an extra loop (what I originally thought and was trying to avoid). I'll give it a shot and see how it goes!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use a nested array! @sroy3, can you take another look at this PR when you have some time since I've basically altered most of my original changes 😅.

const mockBoxes = {
car: [{ box: { bottom: 0, left: 0, right: 0, top: 0 }, score: 0.5 }]
}
const imgDataWithBoundingBoxes = plotsDiffFixture.data[
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another option is adding a new image by step plot with bounding boxes plot to our base comparison fixture.

@julieg18 julieg18 marked this pull request as ready for review February 20, 2024 17:45
@@ -94,7 +94,9 @@ export type ComparisonPlotClass = {
}

export type ComparisonPlotClasses = {
[revision: string]: { [path: string]: ComparisonPlotClass[] }
[revision: string]: {
[path: string]: { [imgInd: number]: ComparisonPlotClass[] }
Copy link
Contributor

Choose a reason for hiding this comment

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

You know the context better than I do, so don't change it if it doesn't make sense or if it's still more complicated, but would using an empty array instead of null make thing simpler? So:

[revision: string]: { [path: string]: ComparisonPlotClass[][] }

@julieg18 julieg18 requested a review from sroy3 February 22, 2024 17:28
@mattseddon mattseddon closed this Mar 12, 2024
@mattseddon mattseddon deleted the fix-bb-img-by-step-plots branch March 12, 2024 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants