-
Notifications
You must be signed in to change notification settings - Fork 3k
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
CVAT-3D Milestone1 #2534
Conversation
…d created a relatedfiles table for PCD to Image mapping.
…ration Scripts and Dimension attribute for MpegChunk Writers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes regarding formats look ok. The only thing I can suggest is adding some kind of enumeration for available values for dimension
args.
@@ -179,25 +194,48 @@ def _make_name(): | |||
|
|||
class ZipReader(ImageListReader): | |||
def __init__(self, source_path, step=1, start=0, stop=None): | |||
self._zip_source = zipfile.ZipFile(source_path[0], mode='r') | |||
self._zip_source = zipfile.ZipFile(source_path[0], mode='a') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a reason to change mode here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We add the converted (bin to PCD), into the in memory zip again, thus we require it to be "a" mode, against creating an entirely new zip
cvat/apps/engine/media_extractors.py
Outdated
|
||
pcd_version = ["0.7", "0.6", "0.5", "0.4", "0.3", "0.2", "0.1", ".7", ".6", ".5", ".4", ".3", ".2", ".1"] | ||
with open(path, "rb") as file_read: | ||
data = file_read.read(70) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw code to parse the header above. It is better to reuse it.
cvat/apps/engine/media_extractors.py
Outdated
if not self.path: | ||
return | ||
actual_path = self.path | ||
for root, dirs, files in os.walk(actual_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhiltsov-max , should the code (import velodyne dataset) migrate to datumaro? Or we prefer to keep it here for a while.
@@ -19,15 +19,17 @@ interface Props { | |||
menuKey: string; | |||
dumpers: any[]; | |||
dumpActivities: string[] | null; | |||
taskDimension: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed code accordingly.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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)
cvat/apps/engine/media_extractors.py
Outdated
def get_zip_filename(self): | ||
return self._zip_source.filename | ||
|
||
def initialize_for_3d(self, source_path, step=1, start=0, stop=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you inherit a new class, this method is no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Instead of multiple "if" in the class, let us create a new one like LidarDataReader or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image dataset and pcd dataset can be in a zip format, to classify if the dataset is for a 2D task or 3D task.
If we create another class as "LidarDataReader", we need to unzip the zip file twice, once for extracting the data in "ZipReader",then again in "LidarReader" class since zip is a common media-type.
Instead we modified the "ZipReader" class to and used reconcile method to distinguish between the dimensionType and now the multiple if's are not present.
It is only checked once on initialisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum for cvat_ui
Hi @nmanovic , The ci/cd build has passed, latest code pushed to PR. |
@@ -569,3 +569,8 @@ export interface CombinedState { | |||
shortcuts: ShortcutsState; | |||
review: ReviewState; | |||
} | |||
|
|||
export enum DimensionType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manasars , we have similar definition in cvat-core/src/enums.js. What is the reason for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in earlier review inputs, we have similar implementation of ReviewStatus in both the places, hence we implemented similarly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmanovic Need to rewrite cvat-core in typescript to avoid this.
@@ -179,7 +183,8 @@ def _make_name(): | |||
|
|||
class ZipReader(ImageListReader): | |||
def __init__(self, source_path, step=1, start=0, stop=None): | |||
self._zip_source = zipfile.ZipFile(source_path[0], mode='r') | |||
self._dimension = DimensionType.DIM_2D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andrey and I asked you to reimplement the class. It is much better to create a class like LidarDataReader inherited from ZipReader and redefine all corresponding methods. Thus you will not need to have if self._dimension == DimensionType.DIM_3D:
mostly in every method. Let me know if you disagree by a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the comments earlier, We distinguish the mime types only after we initialise the zipWriter class as initially we only enquire on what is the extension of the main file, which here is a zip (MediaFile). After the extraction along with picking the names of possible image files, the actual zip is deleted by keeping file pointer open in memory.
Upon deleting of zipExtractor object, the del would close the open file pointer, which is being actively
utilized further in the process. Thus introduction of LidarData Class would disrupt the flow and make it required to
create another zip file or abandon the deletion in the ZipExtractor.
Also if the 2 if
are removed, then we need to introduce if
in places such as FrameProvider, task.py and possibly when
import export is being carried based on dimension.
Kindly let us know your comments on the same.
@@ -283,8 +312,9 @@ def get_image_size(self, i): | |||
return image.width, image.height | |||
|
|||
class IChunkWriter(ABC): | |||
def __init__(self, quality): | |||
def __init__(self, quality, dimension=DimensionType.DIM_2D): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again better to inherit here. For example, IChunkWriter for common code, IChunk2dWriter(IChunkWriter) and IChunk3dWriter(IChunkWriter) or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only parameter we require for distinguishing 2D and 3D task is _dimension which by default is always 2D.
Only in the case of zipCompressedChunkWriter we require the same and only at this point we have an if
.
If another class is created for the same, such as zipCompressed3DChunkWriter along with IChunk3dWriter, then we require to place multiple if
in frameProvider and task.py. Please let me know if you have any different opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does an additional type that is defined here https://github.com/openvinotoolkit/cvat/blob/develop/cvat/apps/engine/models.py#L34-L37 solve this problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @azhavoro,
The additional type mentioned here will not help since the ext type 'zip' can have both images and pcd data and the additional type list accepts list as input whereas we have zip as input.
@manasars , an extra level of directories + temporary files inside archives. Could you please fix that? test_pointcloud_pcd.zip\test_pointcloud_pcd\test_pointcloud_pcd\related_images\000001_pcd |
The same problem with another archive. |
@bsekachev , do you have any questions to the client or server part? Could you please review? |
I do not have critical comments about the patch. Looks like my comments and the most comments of other guys have been resolved. There are several unresolved conversations above opened not by me. |
dimension: { | ||
/** | ||
* @name dimension | ||
* @type {string} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
dimension: { | ||
/** | ||
* @name dimension | ||
* @type {string} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
cvat-core/src/annotation-formats.js
Outdated
@@ -15,6 +15,7 @@ | |||
format: initialData.ext, | |||
version: initialData.version, | |||
enabled: initialData.enabled, | |||
dimension: initialData.dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed trailing comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
cvat-core/src/session.js
Outdated
@@ -974,6 +974,7 @@ | |||
use_zip_chunks: undefined, | |||
use_cache: undefined, | |||
copy_data: undefined, | |||
dimension: undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed trailing comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
cvat-core/src/session.js
Outdated
dimension: { | ||
/** | ||
* @name enabled | ||
* @type {string} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
@@ -161,6 +161,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { | |||
dumpers, | |||
dumpActivities, | |||
menuKey: Actions.DUMP_TASK_ANNO, | |||
taskDimension:jobInstance.task.dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
@@ -169,11 +170,13 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { | |||
onClickMenuWrapper(null, file); | |||
}, | |||
menuKey: Actions.LOAD_JOB_ANNO, | |||
taskDimension:jobInstance.task.dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
})} | ||
{ExportSubmenu({ | ||
exporters: dumpers, | ||
exportActivities, | ||
menuKey: Actions.EXPORT_TASK_DATASET, | ||
taskDimension:jobInstance.task.dimension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
@@ -14,6 +14,7 @@ import Text from 'antd/lib/typography/Text'; | |||
import InputNumber from 'antd/lib/input-number'; | |||
import Button from 'antd/lib/button'; | |||
import notification from 'antd/lib/notification'; | |||
import {DimensionType} from '../../reducers/interfaces' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes accordingly.
@@ -569,3 +569,8 @@ export interface CombinedState { | |||
shortcuts: ShortcutsState; | |||
review: ReviewState; | |||
} | |||
|
|||
export enum DimensionType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nmanovic Need to rewrite cvat-core in typescript to avoid this.
Hi @bsekachev / @nmanovic , |
CVAT-3D : Create a 3D task - Support to upload PCD/BIN files in archived zip.
Changes include:
Added Bin as accepted MIME type under Image Set
Added Dimension Validation Class to verify PCD vs PhotoCD and BIN to PCD conversion.
Added Support for Point Cloud and BIN Files for 3D Tasks.
Added an extra attribute dimension across API's and Formats.
Modified MPEG and Zip Chunk Writer to support PCD
Test Cases:
Manual Unit testing done locally.
Existing test cases work as expected.
[x ] I submit my changes into the
develop
branch[ x] I have added tests to cover my changes
[ x] I submit my code changes under the same MIT License that covers the project.
Feel free to contact the maintainers if that's a concern.