Skip to content

Commit

Permalink
fixed array operations
Browse files Browse the repository at this point in the history
  • Loading branch information
klakhov committed Jun 19, 2023
1 parent a46df53 commit 01f86fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
8 changes: 2 additions & 6 deletions cvat-core/src/annotations-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,8 @@ export default class Collection {
continue;
}

if (filter) {
if (filter.jobID) {
if (object.jobID && (object.jobID !== filter.jobID)) {
continue;
}
}
if (object.jobID && object.jobID !== filter?.jobID) {
continue;
}

let objectType = null;
Expand Down
30 changes: 18 additions & 12 deletions cvat-core/src/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,31 @@ function getCache(sessionType) {
}

function processGroundTruthAnnotations(rawAnnotations, groundTruthAnnotations) {
groundTruthAnnotations.shapes.forEach((annotation) => { annotation.is_gt = true; });
groundTruthAnnotations.tracks.forEach((annotation) => { annotation.is_gt = true; });
groundTruthAnnotations.tags.forEach((annotation) => { annotation.is_gt = true; });
const annotations = [].concat(
groundTruthAnnotations.shapes,
groundTruthAnnotations.tracks,
groundTruthAnnotations.tags,
);
annotations.forEach((annotation) => { annotation.is_gt = true; });
const result = {
shapes: [...rawAnnotations.shapes, ...groundTruthAnnotations.shapes],
tracks: [...rawAnnotations.tracks, ...groundTruthAnnotations.tracks],
tags: [...rawAnnotations.tags, ...groundTruthAnnotations.tags],
shapes: rawAnnotations.shapes.slice(0).concat(groundTruthAnnotations.shapes.slice(0)),
tracks: rawAnnotations.tracks.slice(0).concat(groundTruthAnnotations.tracks.slice(0)),
tags: rawAnnotations.tags.slice(0).concat(groundTruthAnnotations.tags.slice(0)),
};
return result;
}

function addJobId(rawAnnotations, jobID) {
rawAnnotations.shapes.forEach((annotation) => { annotation.job_id = jobID; });
rawAnnotations.tracks.forEach((annotation) => { annotation.job_id = jobID; });
rawAnnotations.tags.forEach((annotation) => { annotation.job_id = jobID; });
const annotations = [].concat(
rawAnnotations.shapes,
rawAnnotations.tracks,
rawAnnotations.tags,
);
annotations.forEach((annotation) => { annotation.job_id = jobID; });
const result = {
shapes: [...rawAnnotations.shapes],
tracks: [...rawAnnotations.tracks],
tags: [...rawAnnotations.tags],
shapes: rawAnnotations.shapes.slice(0),
tracks: rawAnnotations.tracks.slice(0),
tags: rawAnnotations.tags.slice(0),
};
return result;
}
Expand Down

0 comments on commit 01f86fd

Please sign in to comment.