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

Add a Depth Estimation dataset - DIODE / NYUDepth / KITTI #5255

Closed
sayakpaul opened this issue Nov 17, 2022 · 21 comments
Closed

Add a Depth Estimation dataset - DIODE / NYUDepth / KITTI #5255

sayakpaul opened this issue Nov 17, 2022 · 21 comments
Assignees
Labels
dataset request Requesting to add a new dataset

Comments

@sayakpaul
Copy link
Member

sayakpaul commented Nov 17, 2022

Name

NYUDepth

Paper

http://cs.nyu.edu/~silberman/papers/indoor_seg_support.pdf

Data

https://cs.nyu.edu/~silberman/datasets/nyu_depth_v2.html

Motivation

Depth estimation is an important problem in computer vision. We have a couple of Depth Estimation models on Hub as well:

Would be nice to have a dataset for depth estimation. These datasets usually have three things: input image, depth map image, and depth mask (validity mask to indicate if a reading for a pixel is valid or not). Since we already have semantic segmentation datasets on the Hub, I don't think we need any extended utilities to support this addition.

Having this dataset would also allow us to author data preprocessing guides for depth estimation, particularly like the ones we have for other tasks (example).

Ccing @osanseviero @nateraw @NielsRogge

Happy to work on adding it.

@sayakpaul sayakpaul added the dataset request Requesting to add a new dataset label Nov 17, 2022
@osanseviero
Copy link
Member

Also cc @mariosasko and @lhoestq

@lhoestq
Copy link
Member

lhoestq commented Nov 17, 2022

Cool ! Let us know if you have questions or if we can help :)

I guess we'll also have to create the NYU CS Department on the Hub ?

@sayakpaul
Copy link
Member Author

I guess we'll also have to create the NYU CS Department on the Hub ?

Yes, you're right! Let me add it to my profile first, and then we can transfer. Meanwhile, if it's recommended to loop the dataset author in here, let me know.

Also, the NYU Depth dataset seems big. Any example scripts for creating image datasets that I could refer?

@lhoestq
Copy link
Member

lhoestq commented Nov 17, 2022

You can check the imagenet-1k one.

PS: If the licenses allows it, it'b be nice to host the dataset as sharded TAR archives (like imagenet-1k) instead of the ZIP format they use:

  • it will make streaming much faster
  • ZIP compression is not well suited for images
  • it will allow parallel processing of the dataset (you can pass a subset of shards to each worker)

if it's recommended to loop the dataset author in here, let me know.

It's recommended indeed, you can send them an email once you have the dataset ready and invite them to the org on the Hub

@sayakpaul
Copy link
Member Author

You can check the imagenet-1k one.

Where can I find the script? Are you referring to https://huggingface.co/docs/datasets/image_process ? Or is there anything more specific?

@lhoestq
Copy link
Member

lhoestq commented Nov 17, 2022

You can find it here: https://huggingface.co/datasets/imagenet-1k/blob/main/imagenet-1k.py

@sayakpaul sayakpaul self-assigned this Nov 17, 2022
@sayakpaul
Copy link
Member Author

sayakpaul commented Nov 23, 2022

Update: started working on it here: https://huggingface.co/datasets/sayakpaul/nyu_depth_v2.

I am facing an issue and I have detailed it here: https://huggingface.co/datasets/sayakpaul/nyu_depth_v2/discussions/1

Edit: The issue is gone.

However, since the dataset is distributed as a single TAR archive (following the URL used in TensorFlow Datasets) the loading is taking longer. How would suggest to shard the single TAR archive?

@lhoestq

@sayakpaul
Copy link
Member Author

A Colab Notebook demonstrating the dataset loading part:

https://colab.research.google.com/gist/sayakpaul/aa0958c8d4ad8518d52a78f28044d871/scratchpad.ipynb

@osanseviero @lhoestq

I will work on a notebook to work with the dataset including data visualization.

@sayakpaul
Copy link
Member Author

@osanseviero @lhoestq things seem to work fine with the current version of the dataset here. Here's a notebook I developed to help with visualization: https://colab.research.google.com/drive/1K3ZU8XUPRDOYD38MQS9nreQXJYitlKSW?usp=sharing.

@lhoestq I need your help with the following:

However, since the dataset is distributed as a single TAR archive (following the URL used in TensorFlow Datasets) the loading is taking longer. How would suggest to shard the single TAR archive?

@osanseviero @lhoestq question for you:

Where should we host the dataset? I think hosting it under hf.co/datasets (that is HF is the org) is fine as we have ImageNet-1k hosted similarly. We could then reach out to Diana Wofk (author of Fast Depth and the owner of the repo on which TFDS NYU Depth V2 is based) for a review. WDYT?

@lhoestq
Copy link
Member

lhoestq commented Nov 30, 2022

However, since the dataset is distributed as a single TAR archive (following the URL used in TensorFlow Datasets) the loading is taking longer. How would suggest to shard the single TAR archive?

First you can separate the train data and the validation data.

Then since the dataset is quite big, you can even shard the train split and the validation split in multiple TAR archives. Something around 16 archives for train and 4 for validation would be fine for example.

Also no need to gzip the TAR archives, the images are already compressed in png or jpeg.

@sayakpaul
Copy link
Member Author

Then since the dataset is quite big, you can even shard the train split and the validation split in multiple TAR archives. Something around 16 archives for train and 4 for validation would be fine for example.

Yes, I got you. But this process seems to be manual and should be tailored for the given dataset. Do you have any script that you used to create the ImageNet-1k shards?

Also no need to gzip the TAR archives, the images are already compressed in png or jpeg.

I was not going to do that. Not sure what brought it up.

@lhoestq
Copy link
Member

lhoestq commented Nov 30, 2022

Yes, I got you. But this process seems to be manual and should be tailored for the given dataset. Do you have any script that you used to create the ImageNet-1k shards?

I don't, but I agree it'd be nice to have a script for that !

I was not going to do that. Not sure what brought it up.

The original dataset is gzipped for some reason

@sayakpaul
Copy link
Member Author

Oh, I am using this URL for the download: https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/datasets/nyu_depth_v2/nyu_depth_v2_dataset_builder.py#L24.

@lhoestq
Copy link
Member

lhoestq commented Nov 30, 2022

Where should we host the dataset? I think hosting it under hf.co/datasets (that is HF is the org) is fine as we have ImageNet-1k hosted similarly.

Maybe you can create an org for NYU Courant (this is the institute of the lab of the main author of the dataset if I'm not mistaken), and invite the authors to join.

We don't add datasets without namespace anymore

@sayakpaul
Copy link
Member Author

sayakpaul commented Dec 2, 2022

Updates: https://huggingface.co/datasets/sayakpaul/nyu_depth_v2/discussions/5

The entire process (preparing multiple archives, preparing data loading script, etc.) was fun and engaging, thanks to the documentation. I believe we could work on a small blog post that would work as a reference for the future contributors following this path. What say?

Cc: @lhoestq @osanseviero

@lhoestq
Copy link
Member

lhoestq commented Dec 2, 2022

I believe we could work on a small blog post that would work as a reference for the future contributors following this path. What say?

@polinaeterna already mentioned it would be nice to present this process for audio (it's exactly the same), I believe it can be useful to many people

@sayakpaul
Copy link
Member Author

Cool. Let's work on that after the NYU Depth Dataset is fully in on Hub (under the appropriate org). 🤗

@sayakpaul
Copy link
Member Author

@lhoestq need to discuss something while I am adding the dataset card to https://huggingface.co/datasets/sayakpaul/nyu_depth_v2/.

As per Papers With Code, NYU Depth v2 is used for many different tasks:

  • Monocular depth estimation
  • Depth estimation
  • Semantic segmentation
  • Plane instance segmentation
  • ...

So, while writing the supported task part of the dataset card, should we focus on all these? IMO, we could focus on just depth estimation and semantic segmentation for now since we have supported models for these two. WDYT?

Also, I am getting:

remote: Your push was accepted, but with warnings:
remote: - Warning: The task_ids "depth-estimation" is not in the official list: acceptability-classification, entity-linking-classification, fact-checking, intent-classification, multi-class-classification, multi-label-classification, multi-input-text-classification, natural-language-inference, semantic-similarity-classification, sentiment-classification, topic-classification, semantic-similarity-scoring, sentiment-scoring, sentiment-analysis, hate-speech-detection, text-scoring, named-entity-recognition, part-of-speech, parsing, lemmatization, word-sense-disambiguation, coreference-resolution, extractive-qa, open-domain-qa, closed-domain-qa, news-articles-summarization, news-articles-headline-generation, dialogue-generation, dialogue-modeling, language-modeling, text-simplification, explanation-generation, abstractive-qa, open-domain-abstractive-qa, closed-domain-qa, open-book-qa, closed-book-qa, slot-filling, masked-language-modeling, keyword-spotting, speaker-identification, audio-intent-classification, audio-emotion-recognition, audio-language-identification, multi-label-image-classification, multi-class-image-classification, face-detection, vehicle-detection, instance-segmentation, semantic-segmentation, panoptic-segmentation, image-captioning, grasping, task-planning, tabular-multi-class-classification, tabular-multi-label-classification, tabular-single-column-regression, rdf-to-text, multiple-choice-qa, multiple-choice-coreference-resolution, document-retrieval, utterance-retrieval, entity-linking-retrieval, fact-checking-retrieval, univariate-time-series-forecasting, multivariate-time-series-forecasting, visual-question-answering, document-question-answering
remote: ----------------------------------------------------------
remote: Please find the documentation at:
remote: https://huggingface.co/docs/hub/model-cards#model-card-metadata

What should be the plan of action for this?

Cc: @osanseviero

@osanseviero
Copy link
Member

What should be the plan of action for this?

When you merged huggingface/hub-docs#488, there is a JS Interfaces GitHub Actions workflow that runs https://github.com/huggingface/hub-docs/actions/workflows/js-interfaces-tests.yml. It has a step called export-task scripts which exports an interface you can use in dataset. If you look at the logs, it prints out a map. This map can replace https://github.com/huggingface/datasets/blob/main/src/datasets/utils/resources/tasks.json (tasks.json was generated with this script), which should add depth estimation

@sayakpaul
Copy link
Member Author

Thanks @osanseviero.

#5335

@sayakpaul
Copy link
Member Author

Closing the issue as the dataset has been successfully added: https://huggingface.co/datasets/sayakpaul/nyu_depth_v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dataset request Requesting to add a new dataset
Projects
None yet
Development

No branches or pull requests

3 participants