Skip to content

Commit

Permalink
Revert "release 20230419-0818 (#35)"
Browse files Browse the repository at this point in the history
This reverts commit 667ec55.
  • Loading branch information
quoccuong03 committed Apr 20, 2023
1 parent 2698071 commit 52a31ce
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 15,343 deletions.
Binary file removed public/guides/icons/colors/23.png
Binary file not shown.
Binary file removed public/guides/icons/colors/23_s.png
Binary file not shown.
2 changes: 0 additions & 2 deletions src/assets/icons/flag-svgrepo-com.svg

This file was deleted.

3 changes: 1 addition & 2 deletions src/assets/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ export { ReactComponent as Eye } from './bi_eye.svg'
export { ReactComponent as MoveIcon } from './MoveIcon.svg'
export { ReactComponent as Package } from './package.svg'
export { ReactComponent as ChevronRightBlack } from './chevron-right-black.svg'
export { ReactComponent as ChevronRightWhite } from './chevron-right-white.svg'
export { ReactComponent as FlagIcon } from './flag-svgrepo-com.svg'
export { ReactComponent as ChevronRightWhite } from './chevron-right-white.svg'
8 changes: 1 addition & 7 deletions src/data/enums/ItemType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ export enum ATTRIBUTE_TYPE {
SUB_CATEGORY = 'SUB_CATEGORY',
ITEM_COLOR = 'ITEM_COLOR',
ITEM_PATTERN = 'ITEM_PATTERN',
HUMAN_ID = 'HUMAN_ID',
GENDER_SCORE = 'GENDER_SCORE',
STYLE_SCORE = 'STYLE_SCORE',
ITEM_SCORE = 'ITEM_SCORE',
COLOR_SCORE = 'COLOR_SCORE',
PATTERN_SCORE = 'PATTERN_SCORE',
HUMAN_ID = 'HUMAN_ID'
}

export const GENDER = {
Expand Down Expand Up @@ -473,7 +468,6 @@ export enum ITEM_COLOR {
GOLD,
SILVER,
CYAN,
MAGENTA,
UNKNOWN = -1
}

Expand Down
1 change: 0 additions & 1 deletion src/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ export const vi = {
GOLD: 'màu vàng đồng',
SILVER: 'màu bạc',
CYAN: 'xanh ngọc',
MAGENTA: 'màu hồng nóng',
UNKNOWN: 'KHÔNG XÁC ĐỊNH'
},
ITEM_PATTERN: {
Expand Down
2 changes: 1 addition & 1 deletion src/logic/import/MJ/MJImporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class MJImporter extends AnnotationImporter {
imageData.humans = humans;
imageData.items = items;

// console.log('imageData = ', imageData);
console.log('imageData = ', imageData);
return imageData;
}
public static applyAnnotationsFromFile(
Expand Down
5 changes: 0 additions & 5 deletions src/logic/import/MJ/MJUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ export class MJUtils {
gender: parseInt(gender),
type: parseInt(type),
styles: human.style,
styleScore: human.style_score?.split(":").map((score, i) => ({style: human.style_candidates.split(":")[i], score: parseFloat(score)})),
genderScore: human.gender_score,
qc_comment: human.qc_comment,
qc_status: human.qc_status
};
Expand All @@ -149,9 +147,6 @@ export class MJUtils {
color: parseInt(color),
pattern: parseInt(pattern),
styles: item.style,
colorScore: item.color_score?.split(":").map((score, i) => ({color: parseInt(item.colors.split(":")[i]), score: parseFloat(score)})),
patternScore: item.pattern_score?.split(":").map((score, i) => ({pattern: parseInt(item.patterns.split(":")[i]), score: parseFloat(score)})),
itemScore: item.item_score,
qc_comment: item.qc_comment,
qc_status: item.qc_status
};
Expand Down
1 change: 0 additions & 1 deletion src/store/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export enum Action {
UPDATE_OBJECT_DETECTOR_STATUS = '@@UPDATE_OBJECT_DETECTOR_STATUS',
UPDATE_POSE_DETECTOR_STATUS = '@@UPDATE_POSE_DETECTOR_STATUS',
UPDATE_DISABLED_AI_FLAG = '@@UPDATE_DISABLED_AI_FLAG',
UPDATE_SCORE_CRITERIA = '@@UPDATE_SCORE_CRITERIA',

// GENERAL
UPDATE_PROJECT_DATA = '@@UPDATE_PROJECT_DATA',
Expand Down
11 changes: 1 addition & 10 deletions src/store/ai/actionCreators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,4 @@ export function updateDisabledAIFlag(isAIDisabled: boolean): AIActionTypes {
isAIDisabled,
}
}
}

export function updateScoreCriteria(scoreCriteria: any): AIActionTypes {
return {
type: Action.UPDATE_SCORE_CRITERIA,
payload: {
scoreCriteria,
}
}
}
}
16 changes: 1 addition & 15 deletions src/store/ai/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@ const initialState: AIState = {
rejectedSuggestedLabelList: [],
isObjectDetectorLoaded: false,
isPoseDetectorLoaded: false,
isAIDisabled: false,
scoreCriteria: {
gender: 0.8,
style: 0.8,
color: 0.8,
pattern: 0.8,
item: 0.8
}
isAIDisabled: false
};

export function aiReducer(
state = initialState,
action: AIActionTypes
): AIState {
switch (action.type) {
case Action.UPDATE_SCORE_CRITERIA: {
console.log('Action.UPDATE_SCORE_CRITERIA ', action.payload)
return {
...state,
scoreCriteria: action.payload.scoreCriteria
}
}
case Action.UPDATE_SUGGESTED_LABEL_LIST: {
return {
...state,
Expand Down
23 changes: 0 additions & 23 deletions src/store/ai/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ export type AIState = {
suggestedLabelList: string[];
rejectedSuggestedLabelList: string[];
isAIDisabled: boolean;

// SHOWNIQ Vision AI Criteria
scoreCriteria: {
gender: number,
style: number,
color: number,
pattern: number,
item: number
}
}

interface UpdateSuggestedLabelList {
Expand Down Expand Up @@ -57,22 +48,8 @@ interface UpdateDisabledAIFlag {
}
}

interface UpdateScoreCriteria {
type: typeof Action.UPDATE_SCORE_CRITERIA;
payload: {
scoreCriteria: {
gender: number,
style: number,
color: number,
pattern: number,
item: number
}
}
}

export type AIActionTypes = UpdateSuggestedLabelList
| UpdateRejectedSuggestedLabelList
| UpdateObjectDetectorStatus
| UpdatePoseDetectorStatus
| UpdateDisabledAIFlag
| UpdateScoreCriteria
13 changes: 0 additions & 13 deletions src/store/labels/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export type HumanInfo = {
gender: number;
type: number;
styles: string[];
styleScore?: { style: string, score: number }[];
genderScore?: number;
qc_status?: string;
qc_comment?: string
};
Expand All @@ -76,9 +74,6 @@ export type ItemInfo = {
color: number;
pattern: number;
styles: string[];
patternScore?: { pattern: number, score: number }[];
colorScore?: {color: number, score: number}[];
itemScore?: number;
qc_status?: string;
qc_comment?: string;
};
Expand Down Expand Up @@ -120,9 +115,6 @@ export type RectJSON = {
rb_y: number;
};
style: string[];
gender_score?: number;
style_candidates?: string;
style_score?: string;
qc_status?: string;
qc_comment?: string;
}[];
Expand All @@ -135,11 +127,6 @@ export type RectJSON = {
rb_y: number;
};
style: string[];
colors?: string;
color_score?: string;
item_score?: number;
patterns?: string;
pattern_score?: string;
qc_status?: string;
qc_comment?: string;
}[];
Expand Down
9 changes: 0 additions & 9 deletions src/store/selectors/AISelector.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {store} from '../..';

export class AISelector {
public static getScoreCriteria(): {
gender: number,
style: number,
color: number,
pattern: number,
item: number
} {
return store.getState().ai.scoreCriteria;
}
public static getSuggestedLabelList(): string[] {
return store.getState().ai.suggestedLabelList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ interface IProps {
updateActiveHumanID: (humanId: string) => any;
imageStatus?: string ;
qcStatus?: string;
qcComment?: string;
scoreFlag?: boolean;
qcComment?: string
}

interface IState {
Expand Down Expand Up @@ -171,7 +170,7 @@ class LabelInputField extends React.Component<IProps, IState> {
};

public render() {
const {size, id, value, onDelete, onSelectInfo, mode, description, qcStatus, scoreFlag} =
const {size, id, value, onDelete, onSelectInfo, mode, description, qcStatus} =
this.props;

return (
Expand Down Expand Up @@ -226,7 +225,7 @@ class LabelInputField extends React.Component<IProps, IState> {
</div> */}
<div className="ContentWrapper">
<ImageButton
externalClassName={`info ${qcStatus === "R" || scoreFlag ? "danger" : qcStatus === "P" ? "success" : ""}`}
externalClassName={`info ${qcStatus === "R" ? "danger" : qcStatus === "P" ? "success" : ""}`}
image={'ico/info.png'}
imageAlt={'info'}
buttonSize={{width: 30, height: 30}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,4 @@
align-items: center;
align-content: center;
}

.Flag {
margin-left: 10px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import {ImageButton} from '../../../Common/ImageButton/ImageButton';
import {Fade, Tooltip} from '@material-ui/core';
import withStyles from '@material-ui/core/styles/withStyles';
import {LabelActions} from '../../../../logic/actions/LabelActions';
import { FlagIcon } from 'assets/icons';
import { AISelector } from 'store/selectors/AISelector';

const BUTTON_SIZE: ISize = {width: 30, height: 30};
const BUTTON_PADDING: number = 10;
Expand Down Expand Up @@ -165,29 +163,6 @@ class LabelsToolkit extends React.Component<IProps, IState> {
active: isActive
});

const flagCount = ():number => {
const criteria = AISelector.getScoreCriteria()
const humanFlagCount = imagesData[activeImageIndex].humans.filter(
human =>
human.genderScore < criteria.gender
|| (
human.styleScore?.length > 0
&& human.styleScore[0].score < criteria.style
)).length
const itemFlagCount = imagesData[activeImageIndex].items.filter(
item =>
item.itemScore < criteria.item
|| (
item.colorScore?.length > 0
&& item.colorScore[0].score < criteria.color
)
|| (
item.patternScore?.length > 0
&& item.patternScore[0].score < criteria.pattern
)
).length
return humanFlagCount + itemFlagCount;
}
const header = (
<div
key={'Header_' + index}
Expand All @@ -203,10 +178,6 @@ class LabelsToolkit extends React.Component<IProps, IState> {
alt={tabData.imageAlt}
/>
{tabData.headerText}
{flagCount() > 0 && <div className="Flag">
<FlagIcon fill='red' fontSize={"10px"} width={20} height={20} />
<span style={{color: 'red', fontWeight: 'bold'}}>({flagCount()})</span>
</div>}
</div>
<div className="HeaderGroupWrapper">
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
import {Settings} from '../../../../settings/Settings';
import {Fade, Tooltip, withStyles} from '@material-ui/core';
import {ImageButton} from '../../../Common/ImageButton/ImageButton';
import { AISelector } from 'store/selectors/AISelector';

const BUTTON_SIZE: ISize = {width: 30, height: 30};
const BUTTON_PADDING: number = 10;
Expand Down Expand Up @@ -98,7 +97,6 @@ const RectLabelsList: React.FC<IProps> = ({
width: size.width,
height: size.height
};

const listStyleContent: React.CSSProperties = {
width: size.width,
height: imageData.labelRects.length * labelInputFieldHeight
Expand Down Expand Up @@ -136,32 +134,6 @@ const RectLabelsList: React.FC<IProps> = ({
updateActiveLabelId(null);
};

const checkScore = (labelRect: LabelRect): boolean => {
const criteria = AISelector.getScoreCriteria();

if (labelRect.mode === LabelModeType.HUMAN) {
const found = _.find(imageData.humans, {uuid: labelRect.id});
if(found?.genderScore < criteria.gender) {
return true;
}
if(found?.styleScore?.length > 0 && found?.styleScore[0].score < criteria.style) {
return true;
}
} else {
const found = _.find(imageData.items, {uuid: labelRect.id});
if(found?.colorScore?.length > 0 && found?.colorScore[0].score < criteria.color) {
return true;
}
if(found?.itemScore < criteria.item) {
return true;
}
if(found?.patternScore?.length > 0 && found?.patternScore[0].score < criteria.pattern) {
return true;
}
}
return false;
}

const getDescription = (labelRect: LabelRect) => {
if (labelRect.mode === LabelModeType.HUMAN) {
const found = _.find(imageData.humans, {uuid: labelRect.id});
Expand Down Expand Up @@ -352,7 +324,7 @@ const RectLabelsList: React.FC<IProps> = ({
labelRect.status === LabelStatus.ACCEPTED
)
.map((labelRect: LabelRect) => {
const isFlagged = checkScore(labelRect)

return (
<LabelInputField
size={{
Expand All @@ -377,7 +349,6 @@ const RectLabelsList: React.FC<IProps> = ({
imageStatus={imageData.image_status}
qcStatus={labelRect.qc_status}
qcComment={labelRect.qc_comment}
scoreFlag={isFlagged}
/>
);
});
Expand Down
Loading

0 comments on commit 52a31ce

Please sign in to comment.