Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya4607 committed Jul 18, 2020
1 parent f34ba1f commit cccecb0
Show file tree
Hide file tree
Showing 21 changed files with 153 additions and 154 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Datumaro] Added `convert` command to convert datasets directly (<https://github.com/opencv/cvat/pull/1837>)
- [Datumaro] Added an option to specify image extension when exporting datasets (<https://github.com/opencv/cvat/pull/1799>)
- [Datumaro] Added image copying when exporting datasets, if possible (<https://github.com/opencv/cvat/pull/1799>)
- Annotation type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)
- Annotation type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)
- Source type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)
- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)

### Changed
- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)
Expand Down Expand Up @@ -472,8 +472,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.6.1] - 2020-04-14
### Added
- Annotation type to determine whether a drawn shape is auto annotated using Tensorflow Object detection API or manually annotated by the user
- Annotation_type field support for cvat dumper/loader
- Annotation_type field support for tags
- source field support for cvat dumper/loader
- source field support for tags

## Template
```
Expand Down
6 changes: 3 additions & 3 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1732,14 +1732,14 @@ export class CanvasViewImpl implements CanvasView, Listener {

private addText(state: any): SVG.Text {
const { undefinedAttrValue } = this.configuration;
const { label, clientID, attributes, annotationType } = state;
const { label, clientID, attributes, source } = state;
const attrNames = label.attributes.reduce((acc: any, val: any): void => {
acc[val.id] = val.name;
return acc;
}, {});

return this.adoptedText.text((block): void => {
block.tspan(`${label.name} ${clientID} (${annotationType})`).style('text-transform', 'uppercase');
block.tspan(`${label.name} ${clientID} (${source})`).style('text-transform', 'uppercase');
for (const attrID of Object.keys(attributes)) {
const value = attributes[attrID] === undefinedAttrValue
? '' : attributes[attrID];
Expand Down Expand Up @@ -1877,7 +1877,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
'pointer-events': 'none',
'shape-rendering': 'geometricprecision',
'stroke-width': 0,
fill: state.color, // to right fill property when call SVG.Shape::clone(
fill: state.color, // to right fill property when call SVG.Shape::clone()
}).style({
opacity: 0,
});
Expand Down
6 changes: 3 additions & 3 deletions cvat-core/src/annotations-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
frame: Math.min.apply(null, Object.keys(keyframes).map((frame) => +frame)),
shapes: Object.values(keyframes),
group: 0,
annotation_type: objectStates[0].annotationType,
source: objectStates[0].source,
label_id: label.id,
attributes: Object.keys(objectStates[0].attributes)
.reduce((accumulator, attrID) => {
Expand Down Expand Up @@ -764,15 +764,15 @@
points: [...state.points],
type: state.shapeType,
z_order: state.zOrder,
annotation_type: state.annotationType,
source: state.source,
});
} else if (state.objectType === 'track') {
constructed.tracks.push({
attributes: attributes
.filter((attr) => !labelAttributes[attr.spec_id].mutable),
frame: state.frame,
group: 0,
annotation_type: state.annotationType,
source: state.source,
label_id: state.label.id,
shapes: [{
attributes: attributes
Expand Down
48 changes: 24 additions & 24 deletions cvat-core/src/annotations-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
this.removed = false;
this.lock = false;
this.color = color;
this.annotationType = data.annotation_type;
this.source = data.source;
this.updated = Date.now();
this.attributes = data.attributes.reduce((attributeAccumulator, attr) => {
attributeAccumulator[attr.spec_id] = attr.value;
Expand Down Expand Up @@ -296,19 +296,19 @@
}, [this.clientID], frame);
}

_saveAnnotationType(annotationType, frame) {
const undoAnnotationType = this.annotationType;
const redoAnnotationType = annotationType;
_saveSource(source, frame) {
const undoSource = this.source;
const redoSource = source;

this.history.do(HistoryActions.CHANGED_ANNOTATION_TYPE, () => {
this.annotationType = undoAnnotationType;
this.history.do(HistoryActions.CHANGED_SOURCE, () => {
this.source = undoSource;
this.updated = Date.now();
}, () => {
this.annotationType = redoAnnotationType;
this.source = redoSource;
this.updated = Date.now();
}, [this.clientID], frame);

this.annotationType = annotationType;
this.source = source;
}

_validateStateBeforeSave(frame, data, updated) {
Expand Down Expand Up @@ -397,8 +397,8 @@
}
}

if (updated.annotationType) {
checkObjectType('annotationType', data.annotationType, 'string', null);
if (updated.source) {
checkObjectType('source', data.source, 'string', null);
}

return fittedPoints;
Expand All @@ -417,7 +417,7 @@
const anyChanges = updated.label || updated.attributes || updated.points
|| updated.outside || updated.occluded || updated.keyframe
|| updated.zOrder || updated.hidden || updated.lock || updated.pinned
|| updated.annotationType;
|| updated.source;

if (anyChanges) {
this.updated = Date.now();
Expand Down Expand Up @@ -513,7 +513,7 @@
frame: this.frame,
label_id: this.label.id,
group: this.group,
annotation_type: this.annotationType,
source: this.source,
};
}

Expand Down Expand Up @@ -542,7 +542,7 @@
updated: this.updated,
pinned: this.pinned,
frame,
annotationType: this.annotationType,
source: this.source,
};
}

Expand Down Expand Up @@ -642,8 +642,8 @@
this._saveHidden(data.hidden, frame);
}

if (updated.annotationType) {
this._saveAnnotationType(data.annotationType, frame);
if (updated.source) {
this._saveSource(data.source, frame);
}

this.updateTimestamp(updated);
Expand Down Expand Up @@ -686,7 +686,7 @@
frame: this.frame,
label_id: this.label.id,
group: this.group,
annotation_type: this.annotationType,
source: this.source,
attributes: Object.keys(this.attributes).reduce((attributeAccumulator, attrId) => {
if (!labelAttributes[attrId].mutable) {
attributeAccumulator.push({
Expand Down Expand Up @@ -754,7 +754,7 @@
last,
},
frame,
annotationType: this.annotationType,
source: this.source,
};
}

Expand Down Expand Up @@ -1063,7 +1063,7 @@
outside: current.outside,
occluded: current.occluded,
attributes: {},
annotationType: current.annotationType,
source: current.source,
} : undefined;

if (redoShape) {
Expand Down Expand Up @@ -1128,8 +1128,8 @@
this._saveAttributes(data.attributes, frame);
}

if (updated.annotationType) {
this._saveAnnotationType(data.annotationType, frame);
if (updated.source) {
this._saveSource(data.source, frame);
}

if (updated.keyframe) {
Expand Down Expand Up @@ -1198,7 +1198,7 @@
frame: this.frame,
label_id: this.label.id,
group: this.group,
annotation_type: this.annotationType,
source: this.source,
attributes: Object.keys(this.attributes).reduce((attributeAccumulator, attrId) => {
attributeAccumulator.push({
spec_id: attrId,
Expand Down Expand Up @@ -1229,7 +1229,7 @@
color: this.color,
updated: this.updated,
frame,
annotationType: this.annotationType,
source: this.source,
};
}

Expand Down Expand Up @@ -1264,8 +1264,8 @@
this._saveColor(data.color, frame);
}

if (updated.annotationType) {
this._saveAnnotationType(data.annotationType, frame);
if (updated.source) {
this._saveSource(data.source, frame);
}

this.updateTimestamp(updated);
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/annotations-saver.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

const keys = ['id', 'label_id', 'group', 'frame',
'occluded', 'z_order', 'points', 'type', 'shapes',
'attributes', 'value', 'spec_id', 'annotation_type', 'outside'];
'attributes', 'value', 'spec_id', 'source', 'outside'];

// Find created and updated objects
for (const type of Object.keys(exported)) {
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function build() {
LogType,
HistoryActions,
colors,
AnnotationType,
source,
} = require('./enums');

const {
Expand Down Expand Up @@ -532,7 +532,7 @@ function build() {
LogType,
HistoryActions,
colors,
AnnotationType,
source,
},
/**
* Namespace is used for access to exceptions
Expand Down
18 changes: 9 additions & 9 deletions cvat-core/src/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@
/**
* Annotation type
* @enum {string}
* @name AnnotationType
* @name source
* @memberof module:API.cvat.enums
* @property {string} MANUAL 'Manual'
* @property {string} AUTO 'Auto'
* @property {string} MANUAL 'manual'
* @property {string} AUTO 'auto'
* @readonly
*/
const AnnotationType = Object.freeze({
MANUAL:'Manual',
AUTO:'Auto',
const source = Object.freeze({
MANUAL:'manual',
AUTO:'auto',
});

/**
Expand Down Expand Up @@ -204,7 +204,7 @@
* @property {string} CHANGED_LOCK Changed lock
* @property {string} CHANGED_COLOR Changed color
* @property {string} CHANGED_HIDDEN Changed hidden
* @property {string} CHANGED_ANNOTATION_TYPE Changed annotation type
* @property {string} CHANGED_SOURCE Changed source
* @property {string} MERGED_OBJECTS Merged objects
* @property {string} SPLITTED_TRACK Splitted track
* @property {string} GROUPED_OBJECTS Grouped objects
Expand All @@ -224,7 +224,7 @@
CHANGED_PINNED: 'Changed pinned',
CHANGED_COLOR: 'Changed color',
CHANGED_HIDDEN: 'Changed hidden',
CHANGED_ANNOTATION_TYPE: 'Changed annotation type',
CHANGED_SOURCE: 'Changed source',
MERGED_OBJECTS: 'Merged objects',
SPLITTED_TRACK: 'Splitted track',
GROUPED_OBJECTS: 'Grouped objects',
Expand Down Expand Up @@ -257,6 +257,6 @@
LogType,
HistoryActions,
colors,
AnnotationType,
source,
};
})();
22 changes: 11 additions & 11 deletions cvat-core/src/object-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* </br> Necessary fields: objectType, shapeType, frame, updated, group
* </br> Optional fields: keyframes, clientID, serverID
* </br> Optional fields which can be set later: points, zOrder, outside,
* occluded, hidden, attributes, lock, label, color, keyframe, annotationType
* occluded, hidden, attributes, lock, label, color, keyframe, source
*/
constructor(serialized) {
const data = {
Expand All @@ -39,7 +39,7 @@
color: null,
hidden: null,
pinned: null,
annotationType: null,
source: null,
keyframes: serialized.keyframes,
group: serialized.group,
updated: serialized.updated,
Expand Down Expand Up @@ -69,7 +69,7 @@
this.lock = false;
this.color = false;
this.hidden = false;
this.annotationType = false;
this.source = false;

return reset;
},
Expand Down Expand Up @@ -111,18 +111,18 @@
*/
get: () => data.shapeType,
},
annotationType: {
source: {
/**
* @name annotationType
* @type {module:API.cvat.enums.AnnotationType}
* @name source
* @type {module:API.cvat.enums.source}
* @memberof module:API.cvat.classes.ObjectState
* @readonly
* @instance
*/
get: () => data.annotationType,
set: (annotationType) => {
data.updateFlags.annotationType = true;
data.annotationType = annotationType;
get: () => data.source,
set: (source) => {
data.updateFlags.source = true;
data.source = source;
},
},
clientID: {
Expand Down Expand Up @@ -359,7 +359,7 @@

this.label = serialized.label;
this.lock = serialized.lock;
this.annotationType = serialized.annotationType;
this.source = serialized.source;

if (typeof (serialized.zOrder) === 'number') {
this.zOrder = serialized.zOrder;
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export function propagateObjectAsync(
label: objectState.label,
zOrder: objectState.zOrder,
frame: from,
annotationType: objectState.annotationType,
source: objectState.source,
};

await sessionInstance.logger.log(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export default class CanvasWrapperComponent extends React.PureComponent<Props> {
.filter((label: any) => label.id === activeLabelID)[0];
state.occluded = state.occluded || false;
state.frame = frame;
state.annotationType = 'Manual';
state.source = 'manual';
const objectState = new cvat.classes.ObjectState(state);
onCreateAnnotations(jobInstance, frame, [objectState]);
};
Expand Down Expand Up @@ -501,7 +501,7 @@ export default class CanvasWrapperComponent extends React.PureComponent<Props> {
points,
} = event.detail;
state.points = points;
state.annotationType = 'Manual';
state.source = 'manual';
onUpdateAnnotations([state]);
};

Expand Down
Loading

0 comments on commit cccecb0

Please sign in to comment.