-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Model Overview: Object Detection Widgets for Aggregate Methods, Class…
… selection, & IoU Threshold (#1997) * agg method & iou thresh widgets ckpt * class selection widget * widget option format fix * comment fixes * widget size & lint fixes * semiclon lint fix * od widget options refactor * lint complexity fixes * lint complexity fixes * comment fixes * refactor to reduce complexity * complexity refactor * lint fixes * autolint fixes
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
.../src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ObjectDetectionModelOverview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { | ||
ComboBox, | ||
IComboBoxOption, | ||
IProcessedStyleSet, | ||
Slider, | ||
Stack | ||
} from "@fluentui/react"; | ||
import { FluentUIStyles, IDataset } from "@responsible-ai/core-ui"; | ||
import { localization } from "@responsible-ai/localization"; | ||
import React from "react"; | ||
|
||
import { IModelOverviewStyles } from "./ModelOverview.styles"; | ||
|
||
export function getSelectableAggregateMethod(): IComboBoxOption[] { | ||
const selectableAggregateMethods: IComboBoxOption[] = [ | ||
{ | ||
key: "macro", | ||
text: localization.ModelAssessment.ModelOverview.metricTypes.macro | ||
}, | ||
{ | ||
key: "micro", | ||
text: localization.ModelAssessment.ModelOverview.metricTypes.micro | ||
} | ||
]; | ||
return selectableAggregateMethods; | ||
} | ||
|
||
export function getSelectableClassNames(dataset: IDataset): IComboBoxOption[] { | ||
const selectableClassNames: IComboBoxOption[] = []; | ||
if (dataset.class_names) { | ||
for (const className of dataset.class_names) { | ||
selectableClassNames.push({ | ||
key: className, | ||
text: className | ||
}); | ||
} | ||
} | ||
return selectableClassNames; | ||
} | ||
|
||
export interface IObjectDetectionWidgetsProps { | ||
classNames: IProcessedStyleSet<IModelOverviewStyles>; | ||
dataset: IDataset; | ||
} | ||
|
||
export class ObjectDetectionWidgets extends React.PureComponent<IObjectDetectionWidgetsProps> { | ||
public render(): React.ReactNode { | ||
return ( | ||
<Stack.Item> | ||
<ComboBox | ||
id="modelOverviewAggregateMethod" | ||
label={localization.ModelAssessment.ModelOverview.metricsTypeDropdown} | ||
selectedKey={"macro"} | ||
options={getSelectableAggregateMethod()} | ||
className={this.props.classNames.dropdown} | ||
styles={FluentUIStyles.smallDropdownStyle} | ||
/> | ||
<ComboBox | ||
id="modelOverviewClassSelection" | ||
placeholder={ | ||
localization.ModelAssessment.ModelOverview | ||
.classSelectionDropdownPlaceholder | ||
} | ||
label={ | ||
localization.ModelAssessment.ModelOverview.classSelectionDropdown | ||
} | ||
options={getSelectableClassNames(this.props.dataset)} | ||
className={this.props.classNames.dropdown} | ||
styles={FluentUIStyles.smallDropdownStyle} | ||
/> | ||
<Slider | ||
id="iouThreshold" | ||
label={ | ||
localization.ModelAssessment.ModelOverview.iouthresholdDropdown | ||
} | ||
max={100} | ||
className={this.props.classNames.slider} | ||
valueFormat={(value: number): string => `IoU=${value}%`} | ||
showValue | ||
/> | ||
</Stack.Item> | ||
); | ||
} | ||
} |