Skip to content

Commit

Permalink
Merge branch 'develop' into feature/vit-b-classifier
Browse files Browse the repository at this point in the history
  • Loading branch information
omerferhatt authored May 4, 2024
2 parents 02ed0e5 + 3a79a66 commit ad33560
Show file tree
Hide file tree
Showing 27 changed files with 493 additions and 395 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ jobs:
- name: Install SDK
run: |
pip3 install -r ./tests/python/requirements.txt \
-e './cvat-sdk[pytorch]' -e ./cvat-cli
-e './cvat-sdk[pytorch]' -e ./cvat-cli \
--extra-index-url https://download.pytorch.org/whl/cpu
- name: Running REST API and SDK tests
id: run_tests
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ jobs:
- name: Install SDK
run: |
pip3 install -r ./tests/python/requirements.txt \
-e './cvat-sdk[pytorch]' -e ./cvat-cli
-e './cvat-sdk[pytorch]' -e ./cvat-cli \
--extra-index-url https://download.pytorch.org/whl/cpu
- name: Run REST API and SDK tests
id: run_tests
Expand Down
4 changes: 4 additions & 0 deletions changelog.d/20240426_143800_boris_manual_analytics_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Analytics reports calculation may be initiated manually instead of automatic scheduling
(<https://github.com/cvat-ai/cvat/pull/7805>)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Fixed exception 'Could not read property length of undefined' when copy/paste a skeleton point
(<https://github.com/cvat-ai/cvat/pull/7843>)
7 changes: 4 additions & 3 deletions cvat-core/src/analytics-report.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (C) 2023 CVAT.ai Corporation
// Copyright (C) 2023-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

import {
SerializedAnalyticsEntry, SerializedAnalyticsReport, SerializedDataEntry, SerializedTransformationEntry,
SerializedAnalyticsEntry, SerializedAnalyticsReport,
SerializedDataEntry, SerializedTransformationEntry,
} from './server-response-types';
import { ArgumentError } from './exceptions';

Expand Down Expand Up @@ -126,7 +127,7 @@ export default class AnalyticsReport {
#statistics: AnalyticsEntry[];

constructor(initialData: SerializedAnalyticsReport) {
this.#id = initialData.id;
this.#id = initialData.job_id || initialData.task_id || initialData.project_id;
this.#target = initialData.target as AnalyticsReportTarget;
this.#createdDate = initialData.created_date;
this.#statistics = [];
Expand Down
36 changes: 30 additions & 6 deletions cvat-core/src/api-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import CloudStorage from './cloud-storage';
import Organization, { Invitation } from './organization';
import Webhook from './webhook';
import { ArgumentError } from './exceptions';
import { SerializedAsset } from './server-response-types';
import {
AnalyticsReportFilter, QualityConflictsFilter, QualityReportsFilter,
QualitySettingsFilter, SerializedAsset,
} from './server-response-types';
import QualityReport from './quality-report';
import QualityConflict, { ConflictSeverity } from './quality-conflict';
import QualitySettings from './quality-settings';
Expand Down Expand Up @@ -403,7 +406,7 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
return webhooks;
});

implementationMixin(cvat.analytics.quality.reports, async (filter) => {
implementationMixin(cvat.analytics.quality.reports, async (filter: QualityReportsFilter) => {
checkFilter(filter, {
page: isInteger,
pageSize: isPageSize,
Expand All @@ -426,7 +429,7 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
);
return reports;
});
implementationMixin(cvat.analytics.quality.conflicts, async (filter) => {
implementationMixin(cvat.analytics.quality.conflicts, async (filter: QualityConflictsFilter) => {
checkFilter(filter, {
reportID: isInteger,
});
Expand Down Expand Up @@ -502,7 +505,7 @@ export default function implementAPI(cvat: CVATCore): CVATCore {

return mergedConflicts;
});
implementationMixin(cvat.analytics.quality.settings.get, async (filter) => {
implementationMixin(cvat.analytics.quality.settings.get, async (filter: QualitySettingsFilter) => {
checkFilter(filter, {
taskID: isInteger,
});
Expand All @@ -512,7 +515,7 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
const settings = await serverProxy.analytics.quality.settings.get(params);
return new QualitySettings({ ...settings });
});
implementationMixin(cvat.analytics.performance.reports, async (filter) => {
implementationMixin(cvat.analytics.performance.reports, async (filter: AnalyticsReportFilter) => {
checkFilter(filter, {
jobID: isInteger,
taskID: isInteger,
Expand All @@ -527,9 +530,30 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
const reportData = await serverProxy.analytics.performance.reports(params);
return new AnalyticsReport(reportData);
});
implementationMixin(cvat.analytics.performance.calculate, async (
body: Parameters<CVATCore['analytics']['performance']['calculate']>[0],
onUpdate: Parameters<CVATCore['analytics']['performance']['calculate']>[1],
) => {
checkFilter(body, {
jobID: isInteger,
taskID: isInteger,
projectID: isInteger,
});

checkExclusiveFields(body, ['jobID', 'taskID', 'projectID'], []);
if (!('jobID' in body || 'taskID' in body || 'projectID' in body)) {
throw new ArgumentError('One of "jobID", "taskID", "projectID" is required, but not provided');
}

const params = fieldsToSnakeCase(body);
await serverProxy.analytics.performance.calculate(params, onUpdate);
});
implementationMixin(cvat.frames.getMeta, async (type, id) => {
const result = await serverProxy.frames.getMeta(type, id);
return new FramesMetaData({ ...result });
return new FramesMetaData({
...result,
deleted_frames: Object.fromEntries(result.deleted_frames.map((_frame) => [_frame, true])),
});
});

return cvat;
Expand Down
8 changes: 8 additions & 0 deletions cvat-core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@ function build(): CVATCore {
const result = await PluginRegistry.apiWrapper(cvat.analytics.performance.reports, filter);
return result;
},
async calculate(body, onUpdate) {
const result = await PluginRegistry.apiWrapper(
cvat.analytics.performance.calculate,
body,
onUpdate,
);
return result;
},
},
quality: {
async reports(filter = {}) {
Expand Down
14 changes: 9 additions & 5 deletions cvat-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ export default interface CVATCore {
projects: {
get: (
filter: {
id: number;
page: number;
search: string;
sort: string;
filter: string;
id?: number;
page?: number;
search?: string;
sort?: string;
filter?: string;
}
) => Promise<PaginatedResource<Project>>;
searchNames: any;
Expand Down Expand Up @@ -141,6 +141,10 @@ export default interface CVATCore {
};
performance: {
reports: (filter: AnalyticsReportFilter) => Promise<AnalyticsReport>;
calculate: (
body: { jobID?: number; taskID?: number; projectID?: number; },
onUpdate: (status: enums.RQStatus, progress: number, message: string) => void,
) => Promise<void>;
};
};
frames: {
Expand Down
Loading

0 comments on commit ad33560

Please sign in to comment.