Skip to content

Commit

Permalink
Bug fixes: Propagation from the latest frame, number attribute valida…
Browse files Browse the repository at this point in the history
…tion (cvat-ai#1800)

* Improved messages for number attribute validation, fixed propagation from the latest frame, fixed checking of a number attribute

* Updated versions

* Updated changelog
  • Loading branch information
bsekachev authored and Fernando Martínez González committed Aug 3, 2020
1 parent 29ffc69 commit 16428c2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Wrong resolution for resizing a shape (<https://github.com/opencv/cvat/pull/1667>)
- React warning because of not unique keys in labels viewer (<https://github.com/opencv/cvat/pull/1727>)
- A couple of exceptions in AAM related with early object activation (<https://github.com/opencv/cvat/pull/1755>)
- Propagation from the latest frame (<https://github.com/opencv/cvat/pull/1800>)
- Number attribute value validation (didn't work well with floats) (<https://github.com/opencv/cvat/pull/1800>)


### Security
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "3.0.0",
"version": "3.0.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
20 changes: 11 additions & 9 deletions cvat-core/src/annotations-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,15 +817,17 @@
.concat(imported.tracks)
.concat(imported.shapes);

this.history.do(HistoryActions.CREATED_OBJECTS, () => {
importedArray.forEach((object) => {
object.removed = true;
});
}, () => {
importedArray.forEach((object) => {
object.removed = false;
});
}, importedArray.map((object) => object.clientID), objectStates[0].frame);
if (objectStates.length) {
this.history.do(HistoryActions.CREATED_OBJECTS, () => {
importedArray.forEach((object) => {
object.removed = true;
});
}, () => {
importedArray.forEach((object) => {
object.removed = false;
});
}, importedArray.map((object) => object.clientID), objectStates[0].frame);
}

return importedArray.map((value) => value.clientID);
}
Expand Down
3 changes: 1 addition & 2 deletions cvat-core/src/annotations-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@

if (type === AttributeType.NUMBER) {
return +value >= +values[0]
&& +value <= +values[1]
&& !((+value - +values[0]) % +values[2]);
&& +value <= +values[1];
}

if (type === AttributeType.CHECKBOX) {
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.4.0",
"version": "1.4.1",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
18 changes: 12 additions & 6 deletions cvat-ui/src/components/labels-editor/label-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,27 @@ class LabelForm extends React.PureComponent<Props, {}> {
.split(';')
.map((number): number => Number.parseFloat(number));
if (numbers.length !== 3) {
callback('Invalid input');
callback('Three numbers are expected');
}

for (const number of numbers) {
if (Number.isNaN(number)) {
callback('Invalid input');
callback(`"${number}" is not a number`);
}
}

if (numbers[0] >= numbers[1]) {
callback('Invalid input');
const [min, max, step] = numbers;

if (min >= max) {
callback('Minimum must be less than maximum');
}

if (max - min < step) {
callback('Step must be less than minmax difference');
}

if (+numbers[1] - +numbers[0] < +numbers[2]) {
callback('Invalid input');
if (step <= 0) {
callback('Step must be a positive number');
}

callback();
Expand Down

0 comments on commit 16428c2

Please sign in to comment.