Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVAT-3D Milestone1 #2534

Merged
merged 31 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a40d8dd
CVAT-3D Updated the Mime Types with Bin Support, added dependency of …
Dec 7, 2020
6bcac4a
CVAT-3D Added additional column as Dimension for engine_task table an…
Dec 7, 2020
db27800
Added Support for 3D file Upload in BIN and PCD.
Dec 7, 2020
7f89251
Added Dimension attribute defaulting to 2D for importer and exporter.
Dec 7, 2020
0fd3742
Added props passing for dimension attribute, filtering of import, Mig…
Dec 7, 2020
3be8ef9
Modified code as per review comments
Dec 14, 2020
6357751
Updated Unit test cases for 3D task creation
Dec 14, 2020
6baeed3
Refactored Dimension Enum in UI and backend code
Dec 16, 2020
d0c9b4f
Merging dev code with branch code
Dec 16, 2020
13cd5ff
Resolving conflicts
Dec 16, 2020
5be4b3d
Updated Unit Test Case
Dec 16, 2020
9175c07
Refactored TaskDimension to DimensionType, Simplified usage of Dimens…
Dec 18, 2020
a9972e1
Removing manually created test files
Dec 18, 2020
0877de4
Removing old pcd mime-type mapping
Dec 18, 2020
da61f90
Added test files generated by synthetic data using open3d
Dec 22, 2020
5e302c6
Merge branch 'develop' into cvat-3D-M1
Dec 23, 2020
2fd3282
Merged with develop branch latest changes
Dec 23, 2020
9432068
Added libraries required for open3d
Dec 23, 2020
5675d7c
Added files
Dec 23, 2020
d14226a
Added synthethic pcd,bin and img test files
Dec 23, 2020
733e4bb
Modified test file name
Dec 24, 2020
fc5cf64
Merge branch 'develop' into cvat-3D-M1
Dec 24, 2020
45d276f
Trigger travis ci
Dec 24, 2020
6c0d765
Modified test case to ignore 3D preview images
Dec 24, 2020
86c7494
Trigger notification
Dec 24, 2020
7c3017d
Merge branch 'develop' into cvat-3D-M1
Dec 25, 2020
768a17e
Deleting DS Store files
Dec 25, 2020
6879381
Modified test cases as per review comments
Dec 25, 2020
f0217ca
Merge branch 'develop' into cvat-3D-M1
Dec 30, 2020
2af7627
Checking pre-commit hook
Dec 30, 2020
4b61eb4
Fixed Lint issues - precommit hook verification
Dec 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cvat-core/src/annotation-formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
format: initialData.ext,
version: initialData.version,
enabled: initialData.enabled,
dimension: initialData.dimension
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed trailing comma

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes accordingly.

};

Object.defineProperties(this, {
Expand Down Expand Up @@ -58,6 +59,16 @@
*/
get: () => data.enabled,
},
dimension: {
/**
* @name dimension
* @type {string}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be module:API.cvat.enums.TaskDimension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes accordingly.

* @memberof module:API.cvat.classes.Loader
* @readonly
* @instance
*/
get: () => data.dimension,
},
});
}
}
Expand All @@ -74,6 +85,7 @@
format: initialData.ext,
version: initialData.version,
enabled: initialData.enabled,
dimension: initialData.dimension
};

Object.defineProperties(this, {
Expand Down Expand Up @@ -117,6 +129,16 @@
*/
get: () => data.enabled,
},
dimension: {
/**
* @name dimension
* @type {string}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be module:API.cvat.enums.TaskDimension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes accordingly.

* @memberof module:API.cvat.classes.Loader
* @readonly
* @instance
*/
get: () => data.dimension,
},
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion cvat-core/src/api-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
search: isString,
status: isEnum.bind(TaskStatus),
mode: isEnum.bind(TaskMode),
dimension: isString
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
});

if ('search' in filter && Object.keys(filter).length > 1) {
Expand All @@ -198,7 +199,7 @@
}

const searchParams = new URLSearchParams();
for (const field of ['name', 'owner', 'assignee', 'search', 'status', 'mode', 'id', 'page', 'projectId']) {
for (const field of ['name', 'owner', 'assignee', 'search', 'status', 'mode', 'id', 'page', 'projectId', 'dimension']) {
if (Object.prototype.hasOwnProperty.call(filter, field)) {
searchParams.set(field, filter[field]);
}
Expand Down
11 changes: 11 additions & 0 deletions cvat-core/src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@
use_zip_chunks: undefined,
use_cache: undefined,
copy_data: undefined,
dimension: undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed trailing comma

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes accordingly.

};

let updatedFields = {
Expand Down Expand Up @@ -1452,6 +1453,16 @@
updatedFields = fields;
},
},
dimension: {
/**
* @name enabled
* @type {string}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be module:API.cvat.enums.TaskDimension

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes accordingly.

* @memberof module:API.cvat.classes.Loader
* @readonly
* @instance
*/
get: () => data.dimension,
},
}),
);

Expand Down
6 changes: 5 additions & 1 deletion cvat-ui/src/components/actions-menu/actions-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props {
dumpActivities: string[] | null;
exportActivities: string[] | null;
inferenceIsActive: boolean;

taskDimension: string;
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
onClickMenu: (params: ClickParam, file?: File) => void;
}

Expand All @@ -46,6 +46,7 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
dumpActivities,
exportActivities,
loadActivity,
taskDimension,
} = props;

let latestParams: ClickParam | null = null;
Expand Down Expand Up @@ -99,6 +100,7 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
dumpers,
dumpActivities,
menuKey: Actions.DUMP_TASK_ANNO,
taskDimension,
})}
{LoadSubmenu({
loaders,
Expand All @@ -107,11 +109,13 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
onClickMenuWrapper(null, file);
},
menuKey: Actions.LOAD_TASK_ANNO,
taskDimension,
})}
{ExportSubmenu({
exporters: dumpers,
exportActivities,
menuKey: Actions.EXPORT_TASK_DATASET,
taskDimension,
})}
{!!bugTracker && <Menu.Item key={Actions.OPEN_BUG_TRACKER}>Open bug tracker</Menu.Item>}
<Menu.Item disabled={inferenceIsActive} key={Actions.RUN_AUTO_ANNOTATION}>
Expand Down
4 changes: 3 additions & 1 deletion cvat-ui/src/components/actions-menu/dump-submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ interface Props {
menuKey: string;
dumpers: any[];
dumpActivities: string[] | null;
taskDimension: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corresponding above, something like this:

taskDimension: TaskDimension.D2 | TaskDimension.D3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed code accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets' use unified name here DimensionType (like in Python code)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsekachev can we use cvat-core/src/enums.js here? (it might be a hard link of 2 separate modules, I believe)

}

export default function DumpSubmenu(props: Props): JSX.Element {
const { taskMode, menuKey, dumpers, dumpActivities } = props;
const { taskMode, menuKey, dumpers, dumpActivities, taskDimension } = props;

return (
<Menu.SubMenu key={menuKey} title='Dump annotations'>
{dumpers
.sort((a: any, b: any) => a.name.localeCompare(b.name))
.filter((dumper: any): JSX.Element => dumper.dimension === taskDimension)
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
.map(
(dumper: any): JSX.Element => {
const pending = (dumpActivities || []).includes(dumper.name);
Expand Down
4 changes: 3 additions & 1 deletion cvat-ui/src/components/actions-menu/export-submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ interface Props {
menuKey: string;
exporters: any[];
exportActivities: string[] | null;
taskDimension: string;
}

export default function ExportSubmenu(props: Props): JSX.Element {
const { menuKey, exporters, exportActivities } = props;
const { menuKey, exporters, exportActivities, taskDimension } = props;

return (
<Menu.SubMenu key={menuKey} title='Export as a dataset'>
{exporters
.sort((a: any, b: any) => a.name.localeCompare(b.name))
.filter((exporter: any): JSX.Element => exporter.dimension === taskDimension)
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
.map(
(exporter: any): JSX.Element => {
const pending = (exportActivities || []).includes(exporter.name);
Expand Down
4 changes: 3 additions & 1 deletion cvat-ui/src/components/actions-menu/load-submenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ interface Props {
loaders: any[];
loadActivity: string | null;
onFileUpload(file: File): void;
taskDimension: string;
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
}

export default function LoadSubmenu(props: Props): JSX.Element {
const { menuKey, loaders, loadActivity, onFileUpload } = props;
const { menuKey, loaders, loadActivity, onFileUpload, taskDimension } = props;

return (
<Menu.SubMenu key={menuKey} title='Upload annotations'>
{loaders
.sort((a: any, b: any) => a.name.localeCompare(b.name))
.filter((loader: any): JSX.Element => loader.dimension === taskDimension)
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
.map(
(loader: any): JSX.Element => {
const accept = loader.format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ function DetectorRunner(props: Props): JSX.Element {
<Col span={4}>Model:</Col>
<Col span={20}>
<Select
placeholder='Select a model'
placeholder={task.dimension ==='2d'?'Select a model' : "No model available"}
vnishukov marked this conversation as resolved.
Show resolved Hide resolved
disabled = {task.dimension !== '2d'}
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
style={{ width: '100%' }}
onChange={(_modelID: string): void => {
const newmodel = models.filter((_model): boolean => _model.id === _modelID)[0];
Expand Down
1 change: 1 addition & 0 deletions cvat-ui/src/containers/actions-menu/actions-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function ActionsMenuContainer(props: OwnProps & StateToProps & DispatchToProps):
exportActivities={exportActivities}
inferenceIsActive={inferenceIsActive}
onClickMenu={onClickMenu}
taskDimension={taskInstance.dimension}
/>
);
}
Expand Down
13 changes: 7 additions & 6 deletions cvat/apps/dataset_manager/formats/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Importer(_Format):
def __call__(self, src_file, task_data, **options):
raise NotImplementedError()

def _wrap_format(f_or_cls, klass, name, version, ext, display_name, enabled):
def _wrap_format(f_or_cls, klass, name, version, ext, display_name, enabled, dimension="2d"):
import inspect
assert inspect.isclass(f_or_cls) or inspect.isfunction(f_or_cls)
if inspect.isclass(f_or_cls):
Expand All @@ -45,29 +45,30 @@ def __call__(self, *args, **kwargs):
target.DISPLAY_NAME = (display_name or klass.DISPLAY_NAME).format(
NAME=name, VERSION=version, EXT=ext)
assert all([target.NAME, target.VERSION, target.EXT, target.DISPLAY_NAME])
target.DIMENSION = dimension
target.ENABLED = enabled

return target

EXPORT_FORMATS = {}
def exporter(name, version, ext, display_name=None, enabled=True):
def exporter(name, version, ext, display_name=None, enabled=True, dimension="2d"):
assert name not in EXPORT_FORMATS, "Export format '%s' already registered" % name
def wrap_with_params(f_or_cls):
t = _wrap_format(f_or_cls, Exporter,
name=name, ext=ext, version=version, display_name=display_name,
enabled=enabled)
enabled=enabled, dimension=dimension)
key = t.DISPLAY_NAME
assert key not in EXPORT_FORMATS, "Export format '%s' already registered" % name
EXPORT_FORMATS[key] = t
return t
return wrap_with_params

IMPORT_FORMATS = {}
def importer(name, version, ext, display_name=None, enabled=True):
def importer(name, version, ext, display_name=None, enabled=True, dimension="2d"):
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
def wrap_with_params(f_or_cls):
t = _wrap_format(f_or_cls, Importer,
name=name, ext=ext, version=version, display_name=display_name,
enabled=enabled)
enabled=enabled, dimension=dimension)
key = t.DISPLAY_NAME
assert key not in IMPORT_FORMATS, "Import format '%s' already registered" % name
IMPORT_FORMATS[key] = t
Expand All @@ -91,4 +92,4 @@ def make_exporter(name):
import cvat.apps.dataset_manager.formats.pascal_voc
import cvat.apps.dataset_manager.formats.tfrecord
import cvat.apps.dataset_manager.formats.yolo
import cvat.apps.dataset_manager.formats.imagenet
import cvat.apps.dataset_manager.formats.imagenet
1 change: 1 addition & 0 deletions cvat/apps/dataset_manager/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class DatasetFormatSerializer(serializers.Serializer):
ext = serializers.CharField(max_length=64, source='EXT')
version = serializers.CharField(max_length=64, source='VERSION')
enabled = serializers.BooleanField(source='ENABLED')
dimension = serializers.CharField(max_length=64, source='DIMENSION')
bsekachev marked this conversation as resolved.
Show resolved Hide resolved

class DatasetFormatsSerializer(serializers.Serializer):
importers = DatasetFormatSerializer(many=True)
Expand Down
Binary file added cvat/apps/engine/assets/3d_preview.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cvat/apps/engine/media.mimetypes
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ image/jp2 jp2
image/x-portable-bitmap pbm
image/x-eps epsf
image/x-photo-cd pcd
image/bin bin
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
image/jpeg jpe
image/jp2 jpf
image/jpeg jpg
Expand Down
Loading