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

[Object Detection] [Image Explorer] Bounding Box Support with CanvasTools on Flyout #2116

Merged
merged 45 commits into from
Jun 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e47601e
bbox vott template ckpt
Advitya17 Jun 1, 2023
919c428
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 2, 2023
985afb6
canvastools image load ckpt
Advitya17 Jun 5, 2023
658e2a3
loading image from scratch ckpt
Advitya17 Jun 6, 2023
b968a1b
canvastools image loading support
Advitya17 Jun 6, 2023
719f6cf
coordinate fixes
Advitya17 Jun 7, 2023
abd4966
regiondata call + path fix
Advitya17 Jun 7, 2023
344dffb
code cleanup
Advitya17 Jun 7, 2023
ebf035e
image loading ckpt
Advitya17 Jun 7, 2023
4f52c1a
callback image loading support
Advitya17 Jun 8, 2023
c669b2b
lint fixes
Advitya17 Jun 8, 2023
86f6d1c
bounding box working ckpt for fridge
Advitya17 Jun 8, 2023
eff179d
disabling internal imports for vott
Advitya17 Jun 9, 2023
f4201c4
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 9, 2023
02337e5
freeze rough ckpt
Advitya17 Jun 12, 2023
e817544
file refactor lint fix
Advitya17 Jun 12, 2023
ebb7931
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 12, 2023
5011af3
auto lint fixes
Advitya17 Jun 12, 2023
4934303
freeze cleanup
Advitya17 Jun 12, 2023
d3bc853
lint fixes
Advitya17 Jun 12, 2023
372a4b6
image dims arg for frontend bbox
Advitya17 Jun 12, 2023
1df4fe5
lint fixes
Advitya17 Jun 12, 2023
0ff7bbf
lint fixes
Advitya17 Jun 12, 2023
3ec5440
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 12, 2023
a8552e4
image dimension support
Advitya17 Jun 12, 2023
b059524
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 12, 2023
cd9d109
imagedim support comments
Advitya17 Jun 12, 2023
7d59284
image dimension support
Advitya17 Jun 12, 2023
cf4a867
image dimension support
Advitya17 Jun 12, 2023
881a278
canvas module added
Advitya17 Jun 12, 2023
09031cf
image dimension working ckpt
Advitya17 Jun 12, 2023
f656b5e
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 12, 2023
0535f36
comment fix
Advitya17 Jun 13, 2023
3ec914b
cleanup
Advitya17 Jun 13, 2023
08eda10
async image loading support
Advitya17 Jun 13, 2023
9e30a87
lint fixes
Advitya17 Jun 13, 2023
c4ebf9f
lint fixes
Advitya17 Jun 13, 2023
5c38c23
async loading & drawing support
Advitya17 Jun 13, 2023
96eb6a3
bbox ckpt
Advitya17 Jun 13, 2023
66c78e1
Merge branch 'main' of https://github.com/microsoft/responsible-ai-to…
Advitya17 Jun 14, 2023
3e3e54c
reverted max line override
Advitya17 Jun 14, 2023
8e6078f
code cleanups
Advitya17 Jun 14, 2023
b232513
lint fixes
Advitya17 Jun 14, 2023
949b60c
auto lint fixes
Advitya17 Jun 15, 2023
af296dc
comment fixes
Advitya17 Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fixes
Advitya17 committed Jun 14, 2023
commit b23251331cef6b202704554c8997f32667bbf6f3
2 changes: 1 addition & 1 deletion apps/dashboard/src/app/visionApplications.ts
Original file line number Diff line number Diff line change
@@ -72,8 +72,8 @@ export const visionApplications: IApplications = <const>{
class_names: fridgeObjectDetection.class_names,
feature_names: fridgeObjectDetection.feature_names,
features: fridgeObjectDetection.features,
images: fridgeObjectDetection.images,
imageDimensions: fridgeObjectDetection.imageDimensions,
images: fridgeObjectDetection.images,
object_detection_predicted_y:
fridgeObjectDetection.object_detection_predicted_y,
object_detection_true_y:
Original file line number Diff line number Diff line change
@@ -16,6 +16,13 @@ export const fridgeObjectDetection: IDataset = {
[92.000130390912],
[95.33849179841164]
],
imageDimensions: [
[499, 666],
[499, 666],
[499, 666],
[499, 666],
[499, 666]
],
images: fridgeObjectDetectionImages,
object_detection_predicted_y: [
[
@@ -106,12 +113,5 @@ export const fridgeObjectDetection: IDataset = {
[0, 1, 0, 1],
[1, 0, 1, 0],
[0, 1, 0, 1]
],
imageDimensions: [
[499, 666],
[499, 666],
[499, 666],
[499, 666],
[499, 666]
]
};
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ export function loadImageFromBase64(
export function drawBox(
editor: Editor,
dataset: IDataset,
scaleFactor: (coordinate: number, imageScale: number, frameScale: number) => number,
imageDim: [number, number],
objectLabel: number[],
annotation: string,
@@ -68,14 +69,13 @@ export function drawBox(

const [frameWidth, frameHeight] = editor.getFrameSize;
const [imageWidth, imageHeight] = imageDim;
const scaleCoordinate = (coordinate: number, imageDim: number, frameDim: number): number => coordinate / imageDim * frameDim;

// Creating box region
const predBox = RegionData.BuildRectRegionData(
scaleCoordinate(objectLabel[1], imageWidth, frameWidth),
scaleCoordinate(objectLabel[2], imageHeight, frameHeight),
scaleCoordinate(objectLabel[3]-objectLabel[1], imageWidth, frameWidth),
scaleCoordinate(objectLabel[4]-objectLabel[2], imageHeight, frameHeight)
scaleFactor(objectLabel[1], imageWidth, frameWidth),
scaleFactor(objectLabel[2], imageHeight, frameHeight),
scaleFactor(objectLabel[3]-objectLabel[1], imageWidth, frameWidth),
scaleFactor(objectLabel[4]-objectLabel[2], imageHeight, frameHeight)
);

// Initializing bounding box tag
@@ -112,6 +112,8 @@ export function drawBoundingBoxes(
const predictedY : number[][] = dataset.object_detection_predicted_y[item.index];
const trueY : number[][] = dataset.object_detection_true_y[item.index];

const scaleCoordinate = (coordinate: number, imageDim: number, frameDim: number): number => coordinate / imageDim * frameDim;

// Drawing bounding boxes for each ground truth object
for (const [oidx, gtObject] of trueY.entries()) {

@@ -122,7 +124,7 @@ export function drawBoundingBoxes(
// Retrieving label for annotation above the box
const annotation: string = dataset.class_names[gtObject[0]-1];

drawBox(editor, dataset, dataset.imageDimensions[oidx], gtObject, annotation, theme.palette.green, oidx.toString());
drawBox(editor, dataset, scaleCoordinate, dataset.imageDimensions[oidx], gtObject, annotation, theme.palette.green, oidx.toString());
}

// Draws bounding boxes for each predicted object
@@ -137,6 +139,6 @@ export function drawBoundingBoxes(
const confidenceScore: string = (predObject[5] * 100).toFixed(2);
const annotation = `${oidx }.${className }(${ confidenceScore }%)`;

drawBox(editor, dataset, dataset.imageDimensions[oidx], predObject, annotation, theme.palette.magenta, oidx.toString());
drawBox(editor, dataset, scaleCoordinate, dataset.imageDimensions[oidx], predObject, annotation, theme.palette.magenta, oidx.toString());
}
}