Skip to content

Commit

Permalink
Drop Down For Object Detection (#2010)
Browse files Browse the repository at this point in the history
* selecting objects

* adding new mock data

* working!

* adding event listeners - working:

* working button clicks that propagate bw flyout and dashboard

* raiwidgets litning

* fixing ts errors

* Revert "Merge branch 'main' into mult_img_dropdown_v2"

This reverts commit 1da22ff, reversing
changes made to b89e643.

* working changes

* Revert "Revert "Merge branch 'main' into mult_img_dropdown_v2""

This reverts commit 5ff238e.

* cleanup

* cleanup

* libs

* adding tags

* flake

* prettier

* flyout style

* linting again

* reformat to reduce line complex

* linting hopefully last time

* adding localization

* label expl

* styles

* trying to fix proto warning

* reducing number of fake data

* fixing formatting

* yarn lintfixi

* proto poisining

* protocheck

* proto

* proto stuff fixing back to way it was before

* obj sel

* comments from pr
  • Loading branch information
natalie-isak committed Apr 6, 2023
1 parent 5a61ca6 commit 7a56868
Show file tree
Hide file tree
Showing 18 changed files with 432 additions and 486 deletions.
4 changes: 4 additions & 0 deletions apps/dashboard/src/app/visionApplications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export const visionApplications: IApplications = <const>{
feature_names: fridgeObjectDetection.feature_names,
features: fridgeObjectDetection.features,
images: fridgeObjectDetection.images,
object_detection_predicted_y:
fridgeObjectDetection.object_detection_predicted_y,
object_detection_true_y:
fridgeObjectDetection.object_detection_true_y,
predicted_y: fridgeObjectDetection.predicted_y,
target_column: fridgeObjectDetection.target_column,
task_type: fridgeObjectDetection.task_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,222 +10,101 @@ export const fridgeObjectDetection: IDataset = {
class_names: ["can", "carton", "milk_bottle", "water_bottle"],
feature_names: ["mean_pixel_value"],
features: [
[104.99123271568162],
[100.85525405164684],
[94.95100310731573],
[96.79978274868054],
[104.26360328264136],
[103.17153927474568],
[100.46510438294005],
[107.23017305883037],
[99.0281724610382],
[101.77963534676961],
[99.44776239165017],
[100.95152868299161],
[106.07794568115209],
[104.75648393884867],
[103.37283776762735],
[102.08869290131815],
[104.83749079741064],
[107.75417301068603],
[107.5509206601391],
[102.67189534223603],
[103.11996164501174],
[102.84049981845573],
[104.43172731850086],
[99.52725370661243],
[107.8965307993364],
[109.04546329897032],
[99.20243590283671],
[97.06341411551833],
[99.24365547912642],
[106.73680995624883],
[97.70197853163785],
[98.34317584117183],
[102.31904349239018],
[99.53771406677218],
[99.11145313650324],
[106.49444935917882],
[110.24430542767216],
[102.64630060922646],
[105.19050714040694],
[107.18471978993021],
[95.57399182749884],
[101.38944054274715],
[104.51105815234072],
[98.42422984106351],
[100.7372944086371],
[110.05514131365835],
[106.65816718522129],
[97.54293070625737],
[97.02252452853655],
[106.83225710680621],
[106.29126120108084],
[105.55769296350459],
[109.1698853161779],
[104.2213937384278],
[101.75729236250278],
[106.30899837713466],
[97.29137955590862],
[99.89638736933325],
[100.10556147329694],
[96.48332701438913],
[98.51043327897035],
[103.00417752421761],
[94.29227423816602],
[99.78676371762545],
[97.59583732028622],
[97.3087486283879],
[96.268384617082],
[100.52475220711693],
[97.42437928910874],
[99.57597176334652]
[96.30899737412763],
[95.32630225415797],
[1003762680516188],
[92000130390912],
[95.33849179841164]
],
images: fridgeObjectDetectionImages,
object_detection_predicted_y: [
[
[
3, 37.834022521972656, 312.5594787597656, 323.2925109863281,
420728454589844, 0.9872298836708069
],
[
1, 314.43621826171875, 283.4221496582031, 449.1330261230469,
453.67205810546875, 0.9839074611663818
]
],
[
[
3, 97.42891693115234, 272.9599914550781, 231.2677764892578,
533.6878662109375, 0.996311604976654
],
[
1, 218.88287353515625, 291.83258056640625, 431.8615417480469,
403671691894531, 0.9898059964179993
]
],
[
[
2, 47.880287170410156, 1465001831054688, 212.69313049316406,
513.9315795898438, 0.9914382696151733
],
[
4, 322.61370849609375, 1733768920898438, 455.5107421875,
498.9791564941406, 0.9787105917930603
]
],
[
[
1, 323.8299865722656, 207.12034606933594, 457.8669738769531,
412.123779296875, 0.9933412671089172
],
[
3, 52.82023239135742, 3065950927734375, 363.34197998046875,
420689697265625, 0.979895830154419
]
],
[
[
2, 211.66485595703125, 130.76492309570312, 391.742919921875,
507.566650390625, 0.9822636246681213
],
[
4, 98.31806182861328, 172.11666870117188, 2242011108398438,
483.5189208984375, 0.9667745232582092
]
]
],
object_detection_true_y: [
[
[3, 35, 314, 324, 416, 0],
[1, 313, 281, 449, 456, 0]
],
[
[3, 97, 272, 230, 528, 0],
[1, 225, 293, 429, 402, 0]
],
[
[2, 56, 148, 209, 514, 0],
[4, 328, 180, 449, 502, 0]
],
[
[3, 47, 308, 346, 418, 0],
[1, 331, 205, 458, 410, 0]
],
[
[4, 98, 176, 219, 496, 0],
[2, 220, 130, 392, 505, 0]
]
],
predicted_y: [
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 0],
[0, 1, 1, 1],
[0, 0, 0, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[0, 0, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 0, 0, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 0, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 0, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 0, 1, 1],
[1, 0, 1, 1],
[1, 1, 1, 1],
[0, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 0, 0],
[1, 0, 0, 0]
[1, 0, 1, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[1, 0, 1, 0],
[0, 1, 0, 1]
],
target_column: "label",
task_type: DatasetTaskType.ObjectDetection,
true_y: [
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 0, 0, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[0, 1, 1, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[0, 0, 0, 1],
[1, 1, 0, 1],
[1, 1, 0, 1],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 0, 0, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 0, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 0, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 1, 0],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1],
[0, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 0, 0],
[1, 0, 0, 0]
[1, 0, 1, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[1, 0, 1, 0],
[0, 1, 0, 1]
]
};

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/widget/src/app/ModelAssessment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ModelAssessment extends React.Component<IModelAssessmentProps> {
| "requestTestDataRow"
> = {};
if (this.props.config.baseUrl) {
callBack.requestExp = async (data: number): Promise<any[]> => {
callBack.requestExp = async (data: number | number[]): Promise<any[]> => {
return callFlaskService(this.props.config, data, "/get_exp");
};
callBack.requestObjectDetectionMetrics = async (
Expand Down
2 changes: 1 addition & 1 deletion libs/core-ui/src/lib/Context/ModelAssessmentContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export interface IModelAssessmentContext {
abortSignal: AbortSignal
) => Promise<any>;
requestExp?:
| ((index: number, abortSignal: AbortSignal) => Promise<any[]>)
| ((index: number | number[], abortSignal: AbortSignal) => Promise<any[]>)
| undefined;
requestObjectDetectionMetrics?:
| ((
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

export interface IVisionListItem {
[key: string]: string | number | boolean | string[];
[key: string]: string | number | boolean | string[] | number[][];
image: string;
predictedY: string | string[];
trueY: string | string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ export interface IVisionExplanationDashboardData {
class_names: string[];
images: string[];
categorical_features?: string[];
object_detection_predicted_y?: number[][][];
object_detection_true_y?: number[][][];
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getTheme,
mergeStyles
} from "@fluentui/react";
import React from "react";

export interface IFlyoutStyles {
cell: IStyle;
Expand All @@ -26,6 +27,13 @@ export interface IFlyoutStyles {
title: IStyle;
}

export const explanationImage: React.CSSProperties = {
position: "relative",
right: "85"
};

export const explanationImageWidth = "700px";

export const flyoutStyles: () => IProcessedStyleSet<IFlyoutStyles> = () => {
const theme = getTheme();
const title: IStyle = {
Expand Down
Loading

0 comments on commit 7a56868

Please sign in to comment.