Skip to content

Commit

Permalink
wip: delta on tracking with highres
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Valiulin committed Feb 7, 2025
1 parent 38af059 commit 35fc948
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 43 deletions.
2 changes: 0 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@
"--headless",
"--browser",
"chrome",
"--spec",
"cypress/e2e/actions_tasks2/case_101*.js"
],
"outputCapture": "std",
"console": "internalConsole"
Expand Down
48 changes: 7 additions & 41 deletions tests/cypress/e2e/actions_tasks2/case_101_opencv_basic_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
const scaleFrom400 = 12.5;
const width = 400 * scaleFrom400; // =5000
const height = 400 * scaleFrom400;
const delta = 3; // ???
const delta = 3; // ??? probably requires bigger delta or something else
const maxTextWidth = undefined;
const textHeightPx = 77 * scaleFrom400;
const posX = 10 * scaleFrom400;
const posY = 10 * scaleFrom400; // TODO: determine scale of picture
const posY = 10 * scaleFrom400;
const archiveName = `${imageFileName}.zip`;
const archivePath = `cypress/fixtures/${archiveName}`;
const imagesFolder = `cypress/fixtures/${imageFileName}`;
Expand All @@ -81,17 +81,12 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
// cy.task('log', `x:${posX + i * 5}, y:${posY + i * 5}`);
// cy.imageGenerator(imagesFolder, imageFileName + i, width, height, color, posX + i * 5,
// posY + i * 5, labelName, 1, extension);
// TODO: compare times, makeCustomImage might take to long (from 00:58 to 1:30)
cy.makeCustomImage(imagesFolder, `${imageFileName}_${i}`,
width, height,
fontSize, color, textColor,
posX + i * 5 * scaleFrom400, posY + i * 5 * scaleFrom400,
`${labelName}. Num ${i}`, extension,
maxTextWidth);
/* TODO:
1. recreate scale and position of the text as it was previously with jimp but now with canvas
- side quest: draw from ofscreencanvas
*/
}
cy.createZipArchive(directoryToArchive, archivePath);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
Expand All @@ -116,7 +111,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
cy.opencvCreateShape(createOpencvShapeSecondLabel);
});

it.skip('Change the number of points when the shape is drawn. Cancel drawing.', () => {
it('Change the number of points when the shape is drawn. Cancel drawing.', () => {
cy.interactOpenCVControlButton();
cy.get('.cvat-opencv-drawing-tool').click();
pointsMap.forEach((element) => {
Expand All @@ -132,7 +127,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
.find('[role="slider"]')
.type(generateString(4, 'rightarrow'));
cy.get('.cvat_canvas_interact_intermediate_shape').then((_intermediateShape) => {
// Get count of points againe
// Get count of points again
const intermediateShapeNumberPointsAfterChange = _intermediateShape.attr('points').split(' ').length;
// expected 7 to be below 10
expect(intermediateShapeNumberPointsBeforeChange).to.be.lt(
Expand Down Expand Up @@ -166,7 +161,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
cy.get('.cvat_canvas_shape').should('have.length', 2);
});

it.skip('Check "Intelligent scissors blocking feature". Cancel drawing.', () => {
it('Check "Intelligent scissors blocking feature". Cancel drawing.', () => {
cy.interactOpenCVControlButton();
cy.get('.cvat-opencv-drawing-tool').click();
cy.get('.cvat-annotation-header-block-tool-button').click();
Expand Down Expand Up @@ -194,7 +189,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
cy.get('body').type('{Esc}');
});

it.skip('Check "Histogram Equalization" feature.', () => {
it('Check "Histogram Equalization" feature.', () => {
cy.checkPopoverHidden('opencv-control');
cy.interactOpenCVControlButton();
cy.get('.cvat-opencv-control-popover').contains('[role="tab"]', 'Image').click();
Expand Down Expand Up @@ -246,7 +241,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
// });
// cy.get('#cvat_canvas_shape_4').invoke('attr', 'y').then((yVal) => {
// expect(parseFloat(yVal)).to.be.closeTo(y + i * 5 * scaleFrom400, delta);
// }); // TODO: refactor to $shape
// });
cy.get('#cvat_canvas_shape_4').then(($shape) => {
cy.task('log', `x:${+$shape.attr('x')}, y:${+$shape.attr('x')}`);
expect(+$shape.attr('x')).to.be.closeTo(x + i * 5 * scaleFrom400, delta);
Expand All @@ -260,34 +255,5 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
}
});
});
// after(() => assert(0));
});
function loadOpenCV() {
cy.interactOpenCVControlButton();
cy.get('.cvat-opencv-control-popover').within(() => {
cy.contains('OpenCV is loading').should('not.exist');
});
cy.get('body').click();
}

describe.skip('Testing issue 8894', () => {
// TODO: activate it after the fix
it('Create a shape with "TrackerMIL" on a big picture. Look out for a tracking error', () => {
const shapeNumber = 1;
loadOpenCV();
// We will start testing tracking from 2nd frame because it's a bit unstable on inintialization
cy.goToNextFrame(1);
cy.createOpenCVTrack(createRectangleTrack2Points);
cy.get('.cvat-tracking-notice').should('not.exist');
cy.get(`#cvat_canvas_shape_${shapeNumber}`)
.then(() => {
cy.get('.cvat-tracking-notice').should('not.exist');
cy.get(`#cvat-objects-sidebar-state-item-${shapeNumber}`)
.should('contain', 'RECTANGLE TRACK');
// We don't actually check tracking functionality, we just doing load testing
});
cy.goToNextFrame(2);
cy.get('.ant-notification-notice-message').contains('Tracking error').should('not.exist');
});
});
});

0 comments on commit 35fc948

Please sign in to comment.