forked from cvat-ai/cvat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project: export as a dataset (cvat-ai#3365)
- Loading branch information
1 parent
59af610
commit f18b1cb
Showing
75 changed files
with
2,042 additions
and
1,165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,7 @@ on: | |
- 'master' | ||
- 'develop' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
Unit_testing: | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
(() => { | ||
const serverProxy = require('./server-proxy'); | ||
const { getPreview } = require('./frames'); | ||
|
||
const { Project } = require('./project'); | ||
const { exportDataset } = require('./annotations'); | ||
|
||
function implementProject(projectClass) { | ||
projectClass.prototype.save.implementation = async function () { | ||
const trainingProjectCopy = this.trainingProject; | ||
if (typeof this.id !== 'undefined') { | ||
// project has been already created, need to update some data | ||
const projectData = { | ||
name: this.name, | ||
assignee_id: this.assignee ? this.assignee.id : null, | ||
bug_tracker: this.bugTracker, | ||
labels: [...this._internalData.labels.map((el) => el.toJSON())], | ||
}; | ||
|
||
if (trainingProjectCopy) { | ||
projectData.training_project = trainingProjectCopy; | ||
} | ||
|
||
await serverProxy.projects.save(this.id, projectData); | ||
return this; | ||
} | ||
|
||
// initial creating | ||
const projectSpec = { | ||
name: this.name, | ||
labels: [...this.labels.map((el) => el.toJSON())], | ||
}; | ||
|
||
if (this.bugTracker) { | ||
projectSpec.bug_tracker = this.bugTracker; | ||
} | ||
|
||
if (trainingProjectCopy) { | ||
projectSpec.training_project = trainingProjectCopy; | ||
} | ||
|
||
const project = await serverProxy.projects.create(projectSpec); | ||
return new Project(project); | ||
}; | ||
|
||
projectClass.prototype.delete.implementation = async function () { | ||
const result = await serverProxy.projects.delete(this.id); | ||
return result; | ||
}; | ||
|
||
projectClass.prototype.preview.implementation = async function () { | ||
if (!this._internalData.task_ids.length) { | ||
return ''; | ||
} | ||
const frameData = await getPreview(this._internalData.task_ids[0]); | ||
return frameData; | ||
}; | ||
|
||
projectClass.prototype.annotations.exportDataset.implementation = async function ( | ||
format, saveImages, customName, | ||
) { | ||
const result = exportDataset(this, format, customName, saveImages); | ||
return result; | ||
}; | ||
|
||
return projectClass; | ||
} | ||
|
||
module.exports = implementProject; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.