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

feature/141_per-class_coloration #190

Merged
merged 8 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added public/ico/colors-off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/ico/colors-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/ico/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/data/EditorData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {IPoint} from "../interfaces/IPoint";
import {IRect} from "../interfaces/IRect";
import {ISize} from "../interfaces/ISize";
import {IPoint} from '../interfaces/IPoint';
import {IRect} from '../interfaces/IRect';
import {ISize} from '../interfaces/ISize';

export interface EditorData {
viewPortContentSize: ISize,
Expand All @@ -13,4 +13,4 @@ export interface EditorData {
realImageSize: ISize,
viewPortContentImageRect: IRect,
absoluteViewPortContentScrollPosition: IPoint
}
}
24 changes: 12 additions & 12 deletions src/data/ImportFormatData.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import {LabelType} from "./enums/LabelType";
import {ILabelFormatData} from "../interfaces/ILabelFormatData";
import {AnnotationFormatType} from "./enums/AnnotationFormatType";
import {LabelType} from './enums/LabelType';
import {ILabelFormatData} from '../interfaces/ILabelFormatData';
import {AnnotationFormatType} from './enums/AnnotationFormatType';

export type ImportFormatDataMap = Record<LabelType, ILabelFormatData[]>

export const ImportFormatData: ImportFormatDataMap = {
"RECT": [
[LabelType.RECT]: [
{
type: AnnotationFormatType.COCO,
label: "Single file in COCO JSON format."
label: 'Single file in COCO JSON format.'
},
{
type: AnnotationFormatType.YOLO,
label: "Multiple files in YOLO format along with labels names definition - labels.txt file."
label: 'Multiple files in YOLO format along with labels names definition - labels.txt file.'
}
],
"POINT": [],
"LINE": [],
"POLYGON": [
[LabelType.POINT]: [],
[LabelType.LINE]: [],
[LabelType.POLYGON]: [
{
type: AnnotationFormatType.COCO,
label: "Single file in COCO JSON format."
label: 'Single file in COCO JSON format.'
}
],
"IMAGE RECOGNITION": []
}
[LabelType.IMAGE_RECOGNITION]: []
}
10 changes: 5 additions & 5 deletions src/data/enums/LabelType.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export enum LabelType {
IMAGE_RECOGNITION = "IMAGE RECOGNITION",
POINT = "POINT",
RECT = "RECT",
POLYGON = "POLYGON",
LINE = "LINE"
IMAGE_RECOGNITION = 'IMAGE RECOGNITION',
POINT = 'POINT',
RECT = 'RECT',
POLYGON = 'POLYGON',
LINE = 'LINE'
}
16 changes: 8 additions & 8 deletions src/data/enums/PopupWindowType.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export enum PopupWindowType {
LOAD_LABEL_NAMES = "LOAD_LABEL_NAMES",
UPDATE_LABEL = "UPDATE_LABEL",
SUGGEST_LABEL_NAMES = "SUGGEST_LABEL_NAMES",
IMPORT_IMAGES = "IMPORT_IMAGES",
LOAD_AI_MODEL = "LOAD_AI_MODEL",
EXPORT_ANNOTATIONS = "EXPORT_ANNOTATIONS",
IMPORT_ANNOTATIONS = "IMPORT_ANNOTATIONS",
LOAD_LABEL_NAMES = 'LOAD_LABEL_NAMES',
UPDATE_LABEL = 'UPDATE_LABEL',
SUGGEST_LABEL_NAMES = 'SUGGEST_LABEL_NAMES',
IMPORT_IMAGES = 'IMPORT_IMAGES',
LOAD_AI_MODEL = 'LOAD_AI_MODEL',
EXPORT_ANNOTATIONS = 'EXPORT_ANNOTATIONS',
IMPORT_ANNOTATIONS = 'IMPORT_ANNOTATIONS',
INSERT_LABEL_NAMES = 'INSERT_LABEL_NAMES',
EXIT_PROJECT = 'EXIT_PROJECT',
LOADER = 'LOADER'
}
}
6 changes: 3 additions & 3 deletions src/data/enums/ProjectType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum ProjectType {
IMAGE_RECOGNITION = "IMAGE_RECOGNITION",
OBJECT_DETECTION = "OBJECT_DETECTION"
}
IMAGE_RECOGNITION = 'IMAGE_RECOGNITION',
OBJECT_DETECTION = 'OBJECT_DETECTION'
}
78 changes: 39 additions & 39 deletions src/data/info/DropDownMenuData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {updateActivePopupType} from "../../store/general/actionCreators";
import {PopupWindowType} from "../enums/PopupWindowType";
import {store} from "../../index";
import {updateActivePopupType} from '../../store/general/actionCreators';
import {PopupWindowType} from '../enums/PopupWindowType';
import {store} from '../../index';

export type DropDownMenuNode = {
name: string
Expand All @@ -14,74 +14,74 @@ export type DropDownMenuNode = {

export const DropDownMenuData: DropDownMenuNode[] = [
{
name: "Actions",
imageSrc: "ico/actions.png",
imageAlt: "actions",
name: 'Actions',
imageSrc: 'ico/actions.png',
imageAlt: 'actions',
disabled: false,
children: [
{
name: "Edit Labels",
description: "Modify labels list",
imageSrc: "ico/tags.png",
imageAlt: "labels",
name: 'Edit Labels',
description: 'Modify labels list',
imageSrc: 'ico/tags.png',
imageAlt: 'labels',
disabled: false,
onClick: () => store.dispatch(updateActivePopupType(PopupWindowType.UPDATE_LABEL))
},
{
name: "Import Images",
description: "Load more images",
imageSrc: "ico/camera.png",
imageAlt: "images",
name: 'Import Images',
description: 'Load more images',
imageSrc: 'ico/camera.png',
imageAlt: 'images',
disabled: false,
onClick: () => store.dispatch(updateActivePopupType(PopupWindowType.IMPORT_IMAGES))
},
{
name: "Import Annotations",
description: "Import annotations from file",
imageSrc: "ico/import-labels.png",
imageAlt: "import-labels",
name: 'Import Annotations',
description: 'Import annotations from file',
imageSrc: 'ico/import-labels.png',
imageAlt: 'import-labels',
disabled: false,
onClick: () => store.dispatch(updateActivePopupType(PopupWindowType.IMPORT_ANNOTATIONS))
},
{
name: "Export Annotations",
description: "Export annotations to file",
imageSrc: "ico/export-labels.png",
imageAlt: "export-labels",
name: 'Export Annotations',
description: 'Export annotations to file',
imageSrc: 'ico/export-labels.png',
imageAlt: 'export-labels',
disabled: false,
onClick: () => store.dispatch(updateActivePopupType(PopupWindowType.EXPORT_ANNOTATIONS))
},
{
name: "Load AI Model",
description: "Load our pre-trained annotation models",
imageSrc: "ico/ai.png",
imageAlt: "load-ai-model",
name: 'Load AI Model',
description: 'Load our pre-trained annotation models',
imageSrc: 'ico/ai.png',
imageAlt: 'load-ai-model',
disabled: false,
onClick: () => store.dispatch(updateActivePopupType(PopupWindowType.LOAD_AI_MODEL))
},
]
},
{
name: "More",
imageSrc: "ico/more.png",
imageAlt: "more",
name: 'More',
imageSrc: 'ico/more.png',
imageAlt: 'more',
disabled: false,
children: [
{
name: "Documentation",
description: "Read more about Make Sense",
imageSrc: "ico/documentation.png",
imageAlt: "documentation",
name: 'Documentation',
description: 'Read more about Make Sense',
imageSrc: 'ico/documentation.png',
imageAlt: 'documentation',
disabled: false,
onClick: () => window.open("https://skalskip.github.io/make-sense", "_blank")
onClick: () => window.open('https://skalskip.github.io/make-sense', '_blank')
},
{
name: "Bugs and Features",
description: "Report a bug or propose a new feature",
imageSrc: "ico/bug.png",
imageAlt: "bug",
name: 'Bugs and Features',
description: 'Report a bug or propose a new feature',
imageSrc: 'ico/bug.png',
imageAlt: 'bug',
disabled: false,
onClick: () => window.open("https://github.com/SkalskiP/make-sense/issues", "_blank")
onClick: () => window.open('https://github.com/SkalskiP/make-sense/issues', '_blank')
}
]
}
Expand Down
41 changes: 23 additions & 18 deletions src/logic/__tests__/actions/AIObjectDetectionActions.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import {LabelName} from "../../../store/labels/types";
import {DetectedObject} from "@tensorflow-models/coco-ssd";
import {AIObjectDetectionActions} from "../../actions/AIObjectDetectionActions";
import {LabelName} from '../../../store/labels/types';
import {DetectedObject} from '@tensorflow-models/coco-ssd';
import {AIObjectDetectionActions} from '../../actions/AIObjectDetectionActions';

describe('AIObjectDetectionActions extractNewSuggestedLabelNames method', () => {
const mockLabelNames: LabelName[] = [
{
id: "id_1",
name: "label_1"
id: 'id_1',
name: 'label_1',
color: '#000000'
},
{
id: "id_2",
name: "label_2"
id: 'id_2',
name: 'label_2',
color: '#000000'
},
{
id: "id_3",
name: "label_3"
id: 'id_3',
name: 'label_3',
color: '#000000'
}
];

Expand All @@ -24,26 +27,27 @@ describe('AIObjectDetectionActions extractNewSuggestedLabelNames method', () =>
const predictions: DetectedObject[] = [
{
bbox: [1, 2, 3 , 4],
class: "label_3",
class: 'label_3',
score: 0
},
{
bbox: [1, 2, 3 , 4],
class: "label_4",
class: 'label_4',
score: 0
},
{
bbox: [1, 2, 3 , 4],
class: "label_5",
class: 'label_5',
score: 0
}
];

// WHEN
const suggestedLabels: string[] = AIObjectDetectionActions.extractNewSuggestedLabelNames(labelNames, predictions);
const suggestedLabels: string[] = AIObjectDetectionActions
.extractNewSuggestedLabelNames(labelNames, predictions);

// THEN
expect(suggestedLabels.toString()).toBe(["label_4", "label_5"].toString());
expect(suggestedLabels.toString()).toBe(['label_4', 'label_5'].toString());
});

it('should return empty list', () => {
Expand All @@ -52,20 +56,21 @@ describe('AIObjectDetectionActions extractNewSuggestedLabelNames method', () =>
const predictions: DetectedObject[] = [
{
bbox: [1, 2, 3 , 4],
class: "label_3",
class: 'label_3',
score: 0
},
{
bbox: [1, 2, 3 , 4],
class: "label_1",
class: 'label_1',
score: 0
}
];

// WHEN
const suggestedLabels: string[] = AIObjectDetectionActions.extractNewSuggestedLabelNames(labelNames, predictions);
const suggestedLabels: string[] = AIObjectDetectionActions
.extractNewSuggestedLabelNames(labelNames, predictions);

// THEN
expect(suggestedLabels.toString()).toBe([].toString());
});
});
});
Loading