Skip to content

Commit

Permalink
patch tracker-mil maxSize, add params
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Valiulin committed Feb 12, 2025
1 parent 966c631 commit 62afa86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cvat-ui/src/utils/opencv-wrapper/tracker-mil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class TrackerMILImplementation implements TrackerMIL {
this.cv = cv;
this.trackerMIL = new cv.TrackerMIL();
this.imageData = null;
this.maxSize = 2560;
this.maxSize = 1080;
this.imageScale = 1;
this.name = 'TrackerMIL';
}
Expand Down
25 changes: 12 additions & 13 deletions tests/cypress/e2e/actions_tasks2/case_101_opencv_basic_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
const textDefaultValue = 'Some default value for type Text';
const imagesCount = 5;
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`;
const scaleFrom400 = 12.5;
const width = 400 * scaleFrom400;
const height = 400 * scaleFrom400;
const delta = 3;
const width = 5000;
const height = 5000;
const delta = 5;
const step = 62.5;
const maxTextWidth = undefined;
const textHeightPx = 77 * scaleFrom400;
const posX = 10 * scaleFrom400;
const posY = 10 * scaleFrom400;
const textHeightPx = 981.25;
const posX = 125;
const posY = 125;
const archiveName = `${imageFileName}.zip`;
const archivePath = `cypress/fixtures/${archiveName}`;
const imagesFolder = `cypress/fixtures/${imageFileName}`;
Expand All @@ -81,7 +81,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
cy.makeCustomImage(imagesFolder, `${imageFileName}_${i}`,
width, height,
fontSize, color, textColor,
posX + i * 5 * scaleFrom400, posY + i * 5 * scaleFrom400,
posX + i * step, posY + i * step,
`${labelName}. Num ${i}`, extension,
maxTextWidth);
}
Expand Down Expand Up @@ -222,7 +222,7 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()

it('Create a shape with "TrackerMIL". Track it for several frames.', () => {
cy.createRectangle(createRectangleTrack2Points);
// We will start testing tracking from 2-d frame because it's a bit unstable on inintialization
// We will start testing tracking from 2nd frame because it's a bit unstable on inintialization
cy.useOpenCVTracker({ tracker: 'TrackerMIL', targetFrame: 4 });
cy.get('#cvat_canvas_shape_4')
.then((shape) => {
Expand All @@ -231,12 +231,11 @@ context('OpenCV. Intelligent scissors. Histogram Equalization. TrackerMIL.', ()
for (let i = 1; i < imagesCount; i++) {
cy.goToNextFrame(i);
// In the beginning of this test we created images with text
// On each frame text is moved by 5px on x and y axis,
// On each frame text is moved by `${step}px` on x and y axis,
// so we expect shape to be close to real text positions
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);
expect(+$shape.attr('y')).to.be.closeTo(y + i * 5 * scaleFrom400, delta);
expect(+$shape.attr('x')).to.be.closeTo(x + i * step, delta);
expect(+$shape.attr('y')).to.be.closeTo(y + i * step, delta);
});
cy.get('#cvat-objects-sidebar-state-item-4')
.should('contain', 'RECTANGLE TRACK')
Expand Down

0 comments on commit 62afa86

Please sign in to comment.