mlpack / models

models built with mlpack
https://models.mlpack.org/docs
BSD 3-Clause "New" or "Revised" License
35 stars 41 forks source link

Add Image Dataloader for PASCAL VOC and CIFAR 10 dataset. #13

Closed kartikdutt18 closed 4 years ago

kartikdutt18 commented 4 years ago

Hey everyone, This is is a WIP of image data loader for this repo.

TO DO :

KimSangYeon-DGU commented 4 years ago

Hi @kartikdutt18. Regarding Add Resize function to reshape loaded images, if this topic is about the discussion we had in the Community Bonding period, let's put this off. Although I suggested that before, I think the feature to set the size of an image when loading is not vital for this summer work. In addition, the resizing feature is more related to image utils, not data loader.

Please let me know what you think

kartikdutt18 commented 4 years ago

Hey @KimSangYeon-DGU, This is something I missed while making the proposal, The images in PASCAL dataset have different sizes, I can preprocess the images in python and we can store that dataset or We can add a resize feature that uses Bilinear interpolation from mlpack to resize images. Kindly let me know what you think.

KimSangYeon-DGU commented 4 years ago

@kartikdutt18 Ok, then, let's do that :) I don't mind if you do this work on either this PR or another.

kartikdutt18 commented 4 years ago

@kartikdutt18 Ok, then, let's do that :) I don't mind if you do this work on either this PR or another.

Great, I'll do it in this PR first, if get a bit large I can open another one with just that. Thanks a lot.

KimSangYeon-DGU commented 4 years ago

Yes, the best is to implement and use resizing feature in mlpack :) BTW, please let me know if this work turns into a burden for the summer work. We can adjust by going another way as you said above comment.

kartikdutt18 commented 4 years ago

Yes, the best is to implement and use resizing feature in mlpack :) BTW, please let me know if this work turns into a burden for the summer work. We can adjust by going another way as you said above comment.

Thanks a lot, If things go well I should have the resize function ready by tomorrow or the day after. Also, I think it'll be nice to have that feature.

KimSangYeon-DGU commented 4 years ago

Or we can use the third library for image processing like OpenCV as well

kartikdutt18 commented 4 years ago

Or we can use OpenCV as well

Right, That would be much easier. I think have the conversion code for opencv matrix to armadillo so that should be easy to do. Thanks a lot for the amazing suggestion.

KimSangYeon-DGU commented 4 years ago

Yes, and as you know, if you need to use OpenCV, you can do that in mlpack/examples

kartikdutt18 commented 4 years ago

Hey @KimSangYeon-DGU, I completed the main function for PASCAL Dataloader i.e. LoadObjectDetectionDataset. Tested with couple of images and it works fine. I have also added a resize function and augmentation class. In augmentation class only resize is supported for now. Maybe we can open issue if anyone wants to implement some augmentation they can. I haven't used open cv yet because that was much slower than mlpack since we had to iterate over each column however here we pass a batch of images. Things left to do are mentioned below :

  1. Clean up.
  2. Writing tests.
  3. Downloading Pascal VOC dataset from constructor and calling LoadObjectDetectionDataset from constructor.
  4. Writing Documentation for both Object Detection Dataloader and Augmentation class (Might be better to have a separate PR).
  5. Uploading a subset of Dataset to mlpack.org for testing since its not practical to download whole dataset for testing (Roughly 2GB).

Kindly let me know what you think. Regards.

kartikdutt18 commented 4 years ago

Hey @KimSangYeon-DGU, just another update. I have tests for both the data loader as well as augmentation class. I have created a subset that we would can upload to mlpack.org that can be used for testing. Only one thing is left i.e. Calling function through the constructor. If this makes sense I can add that in the next commit. Regards.

KimSangYeon-DGU commented 4 years ago

Nice @kartikdutt18! Since #12 got merged, can you re-base this branch? it helps to review.

Meanwhile, I'll look through this PR :)

kartikdutt18 commented 4 years ago

Also one thing that we could add maybe later (or open an issue) is addition of script to convert csv to xml files.

kartikdutt18 commented 4 years ago

Hey @KimSangYeon-DGU, mlpack's internal split (for labels and features) doesn't work for any other armadillo type other than rowvec and mat type respectively. Should I open a PR to template it or implement it locally here. We would need the validation set for PASCAL after training YOLO because test set of PASCAL is on private evaluation server so they don't host it publicly (unlike the training set). Kindly let me know what you think. Regards.

KimSangYeon-DGU commented 4 years ago

Per discussion and given the timeline, we'll implement the split method locally for internal use for the time being and open an issue about that the mlpack's Split() method needs to use template to work with other Armadillo data types. If the Split() is changed to a template method, we will use it in the future.

kartikdutt18 commented 4 years ago

Agreed, opened mlpack/mlpack#2443 for future discussion.

kartikdutt18 commented 4 years ago

This PR is migrated to #18. Thanks a lot.