-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Gluon data 2.0: c++ dataloader and built-in image/bbox transforms #17841
Conversation
Ping for reviewers' attention. I will fix lint along with review comments to reduce CI triggers. |
|
||
|
||
namespace mxnet { | ||
/*! \brief NaiveCachedOp which does not involve engine which is useful when executed in parallel. |
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.
@eric-haibin-lin how many CachedOp's will we have after the unification?
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.
Awesome job! Would you mind also looking into how we adopt the new FFI?
|
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.
Let's use constructor to initialize the classes instead of requiring users to call Init after construction?
@leezu Sorry I missed this comment. If you look at the creator in c_api used for list and create the existing mxnet iterators: https://github.com/apache/incubator-mxnet/blob/master/src/c_api/c_api.cc#L1859, you will find that the registry is used to hold all uninitialized iterators that has been registered to io module: https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/io/io.py#L984 So if I follow the current registeration patter in python module, I have to follow the empty constructor + init function. |
I'm not convinced. You can change the call signature of the registry and provide |
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.
Added two comments inline to provide more information on how to use constructor
@zhreshold I see, you increased the timeout for the GPU tests. If you are trying to avoid aborts of the |
870bf59
to
5d0ac0f
Compare
@leezu Outstanding comments fixed, can you take another look? |
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.
Thanks @zhreshold!
I have two general questions and also left some comments / requested changes inline:
- What's the plan for python/mxnet/gluon/contrib/data/vision/transform? You mentioned we like to remove vision API and keep it in GluonCV only? Does that not apply to the data API? Will the data API be removed in GluonCV or how is the relation to the one in MXNet?
- How can users run the pipeline / part of it on GPU? Some of the operators added in this PR do have GPU implementations, but I'm not sure how they could be used. Is there any plan on how to extend the current design to integrate with external libraries such as nvidia dali?
For the inline comments, the "requested changes" are with respect to CI Windows build script and the random state in the samplers. The others are more open-ended questions
|
||
return augmenter | ||
|
||
class ImageDataLoader(object): |
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.
This seems to be mostly equivalent to using normal DataLoader
and calling dataset.transform_first(augmenter)
? Would it be easier for users and more maintainable to just use DataLoader
?
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.
It's a thin wrapper on top of DataLoader
, the approach you mentioned is exactly what I was thinking of . In fact, anyone can directly use DataLoader
with transform
or transform_first
by manually compose the transforms.
However, I guess users of the legacy ImageDetIter
won't be happy with the deprecation of the old iterator so I am trying to keep a contrib version with augmenters wrapped in for convenient transition.
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.
Why wouldn't they be happy, given that the composition of transforms appears straightforward?
Having a lot of wrappers around DataLoader will make it harder for us to maintain the codebase in the future, and may also confuse users as it's not clear to them that the manual composition approach is equivalent to using the wrapper. So I wonder if it's better to remove the wrapper and try keep our codebase shorter?
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.
A 200 line of code can save each user 5min at least, especially for beginners. Actually it's not duplicating any code block and can handle most usecases for images.
So I think it's worth the effort to put in gluon.contrib
and get maintained.
|
So the fundamental APIs would only be maintained in MXNet side and removed from GluonCV? |
@leezu Yes |
0a83a6f
to
86b7c3f
Compare
…ache#17841) * c++ dataloader and built-in image/bbox * update * fix error * fix import error * fix ci build * fix vs openmp loop type * fix warning as error with sign/unsign comp * sign/unsign comp * update to pytest * remove nose * fix tear_down * address comments * thread safe dataset * address comments * address comments * fix * serial pytest for data download (cherry picked from commit a0e6735)
…ache#17841) * c++ dataloader and built-in image/bbox * update * fix error * fix import error * fix ci build * fix vs openmp loop type * fix warning as error with sign/unsign comp * sign/unsign comp * update to pytest * remove nose * fix tear_down * address comments * thread safe dataset * address comments * address comments * fix * serial pytest for data download
…ache#17841) * c++ dataloader and built-in image/bbox * update * fix error * fix import error * fix ci build * fix vs openmp loop type * fix warning as error with sign/unsign comp * sign/unsign comp * update to pytest * remove nose * fix tear_down * address comments * thread safe dataset * address comments * address comments * fix * serial pytest for data download
Description
This is the implementation for proposal #17269
Changes
The major components of this PR is:
gluon.data.datasets
andgluon.data.vision.datasets
Stack
,Pad
,Groups
mx.image.ImageIter
andmx.image.ImageDetIter
for simplest interface for loading image classification and object detection datsets.Code Review
Since this PR involves lots of backend and frontend changes and can not be easily divided into multiple PRs, so I would like to suggest modular code reviews:
nn.sequential
andnn.HybridSequential
to allow Sequential block to take more than 1 argumentsThank you for everyone who participate in code review and sorry about the size of this PR.