Skip to content

Commit 7753c58

Browse files
author
Boris Sekachev
committed
merged develop
2 parents df53299 + e1198c3 commit 7753c58

File tree

16 files changed

+264
-42
lines changed

16 files changed

+264
-42
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727

2828
### Fixed
2929

30-
- TDB
30+
- Fixed multiple tasks moving (<https://github.com/openvinotoolkit/cvat/pull/3517>)
31+
- Fixed task creating CLI parameter (<https://github.com/openvinotoolkit/cvat/pull/3519>)
3132

3233
### Security
3334

components/analytics/logstash/logstash.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ output {
124124
if [type] == "client" {
125125
elasticsearch {
126126
hosts => ["${LOGSTASH_OUTPUT_HOST}"]
127-
index => "cvat.client"
127+
index => "%{[@metadata][target_index_client]}"
128128
user => "${LOGSTASH_OUTPUT_USER:}"
129129
password => "${LOGSTASH_OUTPUT_PASS:}"
130130
manage_template => false
131131
}
132132
} else if [type] == "server" {
133133
elasticsearch {
134134
hosts => ["${LOGSTASH_OUTPUT_HOST}"]
135-
index => "cvat.server"
135+
index => "%{[@metadata][target_index_server]}"
136136
user => "${LOGSTASH_OUTPUT_USER:}"
137137
password => "${LOGSTASH_OUTPUT_PASS:}"
138138
manage_template => false

cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/opencv-control.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class OpenCVControlComponent extends React.PureComponent<Props & DispatchToProps
229229
notification.error({
230230
description: error.toString(),
231231
message: 'OpenCV.js processing error occured',
232+
className: 'cvat-notification-notice-opencv-processing-error',
232233
});
233234
}
234235
};
@@ -263,6 +264,7 @@ class OpenCVControlComponent extends React.PureComponent<Props & DispatchToProps
263264
notification.error({
264265
description: error.toString(),
265266
message: 'OpenCV.js processing error occured',
267+
className: 'cvat-notification-notice-opencv-processing-error',
266268
});
267269
} finally {
268270
this.disableCanvasForceUpdate();

cvat-ui/src/components/move-task-modal/move-task-modal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ export default function MoveTaskModal(): JSX.Element {
3434
const [labelMap, setLabelMap] = useState<{ [key: string]: LabelMapperItemValue }>({});
3535

3636
const initValues = (): void => {
37+
const labelValues: { [key: string]: LabelMapperItemValue } = {};
3738
if (task) {
38-
const labelValues: { [key: string]: LabelMapperItemValue } = {};
3939
task.labels.forEach((label: any) => {
4040
labelValues[label.id] = {
4141
labelId: label.id,
4242
newLabelName: null,
4343
clearAttributes: true,
4444
};
4545
});
46-
setLabelMap(labelValues);
4746
}
47+
setLabelMap(labelValues);
4848
};
4949

5050
const onCancel = (): void => {

cvat-ui/src/utils/opencv-wrapper/histogram-equalization.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ export default class HistogramEqualizationImplementation implements HistogramEqu
6060
this.hashFrame(imgData, frameNumber);
6161
return imgData;
6262
} catch (e) {
63-
console.log('Histogram equalization error', e);
64-
return src;
63+
throw new Error(e.toString());
6564
} finally {
6665
if (matImage) matImage.delete();
6766
if (channels) channels.delete();

cvat-ui/src/utils/opencv-wrapper/opencv-wrapper.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface Contours {
2020
}
2121

2222
export interface ImgProc {
23-
hist: () => HistogramEqualization
23+
hist: () => HistogramEqualization;
2424
}
2525

2626
export class OpenCVWrapper {
@@ -41,10 +41,6 @@ export class OpenCVWrapper {
4141
const contentLength = response.headers.get('Content-Length');
4242
const { body } = response;
4343

44-
if (contentLength === null) {
45-
throw new Error('Content length is null, but necessary');
46-
}
47-
4844
if (body === null) {
4945
throw new Error('Response body is null, but necessary');
5046
}
@@ -64,7 +60,9 @@ export class OpenCVWrapper {
6460
if (value instanceof Uint8Array) {
6561
decodedScript += decoder.decode(value);
6662
receivedLength += value.length;
67-
const percentage = (receivedLength * 100) / +(contentLength as string);
63+
// Cypress workaround: content-length is always zero in cypress, it is done optional here
64+
// Just progress bar will be disabled
65+
const percentage = contentLength ? (receivedLength * 100) / +(contentLength as string) : 0;
6866
onProgress(+percentage.toFixed(0));
6967
}
7068
}

site/content/en/docs/manual/advanced/cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ comprehensive CVAT administration tool in the future.
1212

1313
Overview of functionality:
1414

15-
- Create a new task (supports name, bug tracker, labels JSON, local/share/remote files)
15+
- Create a new task (supports name, bug tracker, project, labels JSON, local/share/remote files)
1616
- Delete tasks (supports deleting a list of task IDs)
1717
- List all tasks (supports basic CSV or JSON output)
1818
- Download JPEG frames (supports a list of frame IDs)

tests/cypress/integration/actions_tasks/case_100_settings_default_number_of_points_in_polygon_approximation.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// <reference types="cypress" />
66

77
import { taskName } from '../../support/const';
8+
import { generateString } from '../../support/utils';
89

910
context('Settings. Default number of points in polygon approximation.', () => {
1011
const caseId = '100';
@@ -26,14 +27,6 @@ context('Settings. Default number of points in polygon approximation.', () => {
2627
});
2728
}
2829

29-
function generateString(countPointsToMove) {
30-
let action = '';
31-
for (let i = 0; i < countPointsToMove; i++) {
32-
action += '{rightarrow}';
33-
}
34-
return action;
35-
}
36-
3730
before(() => {
3831
cy.openTaskJob(taskName);
3932
});
@@ -43,7 +36,7 @@ context('Settings. Default number of points in polygon approximation.', () => {
4336
testOpenSettingsWorkspace();
4437
cy.get('.cvat-workspace-settings-approx-poly-threshold')
4538
.find('[role="slider"]')
46-
.type(generateString(4))
39+
.type(generateString(4, 'rightarrow'))
4740
.then((slider) => {
4841
const sliderAttrValueNow = slider.attr('aria-valuenow');
4942
const sliderAttrValuemin = slider.attr('aria-valuemin');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright (C) 2021 Intel Corporation
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
/// <reference types="cypress" />
6+
7+
import { taskName, labelName } from '../../support/const';
8+
9+
context('Create a link for shape, frame.', () => {
10+
const caseId = '102';
11+
const createRectangleShape2Points = {
12+
points: 'By 2 Points',
13+
type: 'Shape',
14+
labelName: labelName,
15+
firstX: 250,
16+
firstY: 350,
17+
secondX: 350,
18+
secondY: 450,
19+
};
20+
21+
before(() => {
22+
cy.openTaskJob(taskName);
23+
cy.createRectangle(createRectangleShape2Points);
24+
cy.saveJob('PATCH', 200, `case${caseId}`);
25+
});
26+
27+
describe(`Testing case "${caseId}"`, () => {
28+
it('Create a link for a shape, for a frame.', () => {
29+
cy.window().then(win => {
30+
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptShape');
31+
});
32+
cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover');
33+
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated')
34+
cy.get('.cvat-object-item-menu').last().should('be.visible').contains('button', 'Create object URL').click();
35+
cy.get('@copyToClipboardPromptShape').should('be.called');
36+
cy.get('@copyToClipboardPromptShape').then(prompt => {
37+
const url = prompt.args[0][1];
38+
expect(url).include('frame=');
39+
expect(url).include('type=');
40+
expect(url).include('serverID=');
41+
cy.visit(url);
42+
cy.closeModalUnsupportedPlatform();
43+
cy.get('.cvat-canvas-container').should('be.visible');
44+
cy.get('#cvat_canvas_shape_1').should('be.visible');
45+
});
46+
47+
cy.window().then(win => {
48+
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptFrame');
49+
});
50+
cy.get('.cvat-player-frame-url-icon').click();
51+
cy.get('@copyToClipboardPromptFrame').should('be.called');
52+
cy.get('@copyToClipboardPromptFrame').then(prompt => {
53+
const url = prompt.args[0][1];
54+
expect(url).include('frame=');
55+
expect(url).not.include('type=');
56+
expect(url).not.include('serverID=');
57+
cy.visit(url);
58+
cy.get('.cvat-canvas-container').should('be.visible');
59+
cy.get('#cvat_canvas_shape_1').should('be.visible');
60+
});
61+
});
62+
});
63+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright (C) 2021 Intel Corporation
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
/// <reference types="cypress" />
6+
7+
import { taskName, labelName } from '../../support/const';
8+
import { generateString } from '../../support/utils';
9+
10+
context('OpenCV. Intelligent cissors. Histogram Equalization.', () => {
11+
const caseId = '101';
12+
const newLabel = `Case ${caseId}`
13+
const createOpencvShape = {
14+
labelName: labelName,
15+
pointsMap: [
16+
{ x: 200, y: 200 },
17+
{ x: 250, y: 200 },
18+
{ x: 300, y: 250 },
19+
{ x: 350, y: 300 },
20+
{ x: 300, y: 350 },
21+
],
22+
};
23+
const createOpencvShapeSecondLabel = {
24+
labelName: newLabel,
25+
pointsMap: [
26+
{ x: 300, y: 200 },
27+
{ x: 350, y: 200 },
28+
{ x: 400, y: 250 },
29+
{ x: 450, y: 300 },
30+
{ x: 400, y: 350 },
31+
],
32+
finishWithButton: true,
33+
};
34+
const keyCodeN = 78;
35+
const pointsMap = [
36+
{ x: 300, y: 400 },
37+
{ x: 350, y: 500 },
38+
{ x: 400, y: 450 },
39+
{ x: 450, y: 500 },
40+
{ x: 400, y: 550 },
41+
];
42+
43+
function openOpencvControlPopover() {
44+
cy.get('body').focus();
45+
cy.get('.cvat-tools-control').trigger('mouseleave').trigger('mouseout').trigger('mouseover');
46+
}
47+
48+
before(() => {
49+
cy.openTask(taskName);
50+
cy.addNewLabel(newLabel);
51+
cy.openJob();
52+
});
53+
54+
describe(`Testing case "${caseId}"`, () => {
55+
it('Load OpenCV.', () => {
56+
openOpencvControlPopover();
57+
cy.get('.cvat-opencv-control-popover-visible').find('.cvat-opencv-initialization-button').click();
58+
// Intelligent cissors button be visible
59+
cy.get('.cvat-opencv-drawing-tool').should('exist').and('be.visible');
60+
});
61+
62+
it('Create a shape with "Intelligent cissors". Create the second shape with the label change and "Done" button.', () => {
63+
cy.opencvCreateShape(createOpencvShape);
64+
cy.opencvCreateShape(createOpencvShapeSecondLabel);
65+
});
66+
67+
it('Change the number of points when the shape is drawn. Cancel drawing.', () => {
68+
openOpencvControlPopover();
69+
cy.get('.cvat-opencv-drawing-tool').click();
70+
pointsMap.forEach((element) => {
71+
cy.get('.cvat-canvas-container').click(element.x, element.y);
72+
});
73+
cy.get('.cvat_canvas_interact_intermediate_shape').then((intermediateShape) => {
74+
// Get count of points
75+
const intermediateShapeNumberPointsBeforeChange = intermediateShape.attr('points').split(' ').length;
76+
// Change number of points
77+
cy.get('.cvat-approx-poly-threshold-wrapper')
78+
.find('[role="slider"]')
79+
.type(generateString(4, 'rightarrow'));
80+
cy.get('.cvat_canvas_interact_intermediate_shape').then((intermediateShape) => {
81+
// Get count of points againe
82+
const intermediateShapeNumberPointsAfterChange = intermediateShape.attr('points').split(' ').length;
83+
// expected 7 to be below 10
84+
expect(intermediateShapeNumberPointsBeforeChange).to.be.lt(intermediateShapeNumberPointsAfterChange);
85+
});
86+
});
87+
cy.get('body').type('{Esc}'); // Cancel drawing
88+
cy.get('.cvat_canvas_interact_intermediate_shape').should('not.exist');
89+
cy.get('.cvat_canvas_shape').should('have.length', 2);
90+
});
91+
92+
it('Check "Histogram Equalization" feature.', () => {
93+
openOpencvControlPopover();
94+
cy.get('.cvat-opencv-control-popover-visible').contains('[role="tab"]', 'Image').click();
95+
cy.get('.cvat-opencv-image-tool').click().should('have.class', 'cvat-opencv-image-tool-active').trigger('mouseout');
96+
cy.get('.cvat-notification-notice-opencv-processing-error').should('not.exist');
97+
cy.get('.cvat-opencv-image-tool').click().should('not.have.class', 'cvat-opencv-image-tool-active').trigger('mouseout');
98+
});
99+
100+
// Waiting for fix https://github.com/openvinotoolkit/cvat/issues/3474
101+
it.skip('Redraw the shape created with "Intelligent cissors".', () => {
102+
cy.get('.cvat-canvas-container').click();
103+
cy.get('.cvat-opencv-control-popover').should('be.hidden');
104+
cy.get('#cvat_canvas_shape_1')
105+
.trigger('mousemove')
106+
.trigger('mouseover')
107+
.should('have.class', 'cvat_canvas_shape_activated');
108+
cy.get('body').trigger('keydown', { keyCode: keyCodeN, shiftKey: true }).trigger('keyup');
109+
cy.get('.cvat-tools-control').should('have.attr', 'tabindex');
110+
createOpencvShape.pointsMap.forEach((el) => {
111+
cy.get('.cvat-canvas-container')
112+
.click(el.x + 150, el.y + 50)
113+
});
114+
cy.get('body').trigger('keydown', { keyCode: keyCodeN }).trigger('keyup');
115+
});
116+
});
117+
});

tests/cypress/integration/actions_tasks2/case_23_canvas_grid_feature.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
/// <reference types="cypress" />
66

77
import { taskName } from '../../support/const';
8+
import { generateString } from '../../support/utils';
89

910
context('Canvas grid feature', () => {
1011
const caseId = '23';
1112
const settingsGridSize = 50;
1213
const gridColor = 'Black';
1314
const gridOpacity = 80;
1415

15-
function generateString(countPointsToMove) {
16-
let action = '';
17-
for (let i = 0; i < countPointsToMove; i++) {
18-
action += '{leftarrow}';
19-
}
20-
return action;
21-
}
22-
2316
before(() => {
2417
cy.openTaskJob(taskName);
2518
cy.get('.cvat-canvas-image-setups-trigger').click();
@@ -44,7 +37,7 @@ context('Canvas grid feature', () => {
4437
});
4538
it('Set "Grid opacity" to 80%.', () => {
4639
cy.get('.cvat-image-setups-grid-opacity-input').within(() => {
47-
cy.get('[role="slider"]').type(generateString(20)); // Moving the slider to the left up to 80.
40+
cy.get('[role="slider"]').type(generateString(20, 'leftarrow')); // Moving the slider to the left up to 80.
4841
cy.get('[role="slider"]').should('have.attr', 'aria-valuenow', gridOpacity);
4942
});
5043
});

tests/cypress/integration/actions_tasks2/case_26_canvas_brightness_contrast_saturation_feature.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// <reference types="cypress" />
66

77
import { taskName } from '../../support/const';
8+
import { generateString } from '../../support/utils';
89

910
context('Canvas brightness/contrast/saturation feature', () => {
1011
const caseId = '26';
@@ -17,14 +18,6 @@ context('Canvas brightness/contrast/saturation feature', () => {
1718
'.cvat-image-setups-saturation',
1819
];
1920

20-
function generateStringCountAction(countAction) {
21-
let stringAction = '';
22-
for (let i = 0; i < countAction; i++) {
23-
stringAction += '{rightarrow}';
24-
}
25-
return stringAction;
26-
}
27-
2821
function checkStateValuesInBackground(expectedValue) {
2922
cy.get('#cvat_canvas_background')
3023
.should('have.attr', 'style')
@@ -41,7 +34,7 @@ context('Canvas brightness/contrast/saturation feature', () => {
4134

4235
describe(`Testing case "${caseId}"`, () => {
4336
it('Check apply of settings', () => {
44-
let stringAction = generateStringCountAction(countActionMoveSlider);
37+
let stringAction = generateString(countActionMoveSlider, 'rightarrow');
4538
cy.get('.cvat-canvas-image-setups-content').within(() => {
4639
cy.wrap(classNameSliders).each(($el) => {
4740
cy.wrap($el)

0 commit comments

Comments
 (0)