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

Update docs for nyu_depth_v2 dataset #5484

Merged
merged 7 commits into from
Feb 5, 2023

Conversation

awsaf49
Copy link
Contributor

@awsaf49 awsaf49 commented Jan 30, 2023

This PR will fix the issue mentioned in #5461. Here is brief overview,

Bug:

Discrepancy between depth map of nyu_depth_v2 dataset here and actual depth map. Depth values somehow got discretized/clipped resulting in depth maps that are different from actual ones. Here is a side-by-side comparison,

image

Fix:

When I first loaded the datasets from HF I noticed it was 30GB but in DenseDepth data is only 4GB with dtype=uint8. This means data from fast-depth (before loading to HF) must have high precision. So when I tried to dig deeper by directly loading depth_map from h5py, I found depth_map from h5py came with float32. But when the data is processed in HF with datasets.Image() it was directly converted to uint8 from float32 hence the discretized depth map.

elif isinstance(value, np.ndarray):
# convert the image array to png bytes
image = PIL.Image.fromarray(value.astype(np.uint8))

cc: @sayakpaul @lhoestq

@awsaf49
Copy link
Contributor Author

awsaf49 commented Jan 30, 2023

I think I need to create another PR on https://huggingface.co/datasets/huggingface/documentation-images/tree/main/datasets for hosting the images there?

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks a lot for working on this! Just a few nits.

docs/source/depth_estimation.mdx Show resolved Hide resolved
docs/source/depth_estimation.mdx Show resolved Hide resolved
docs/source/depth_estimation.mdx Outdated Show resolved Hide resolved
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 30, 2023

The documentation is not available anymore as the PR was closed or merged.

@lhoestq
Copy link
Member

lhoestq commented Jan 31, 2023

Thanks for the update @awsaf49 !

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the updates!

Just some minor things remain and the we should be good to ship this 🚀

docs/source/depth_estimation.mdx Outdated Show resolved Hide resolved
docs/source/depth_estimation.mdx Outdated Show resolved Hide resolved
@awsaf49
Copy link
Contributor Author

awsaf49 commented Feb 2, 2023

Thanks a lot for the updates!

Just some minor things remain and the we should be good to ship this 🚀

@sayakpaul I have updated the minor things. Please approve the workflows

@awsaf49
Copy link
Contributor Author

awsaf49 commented Feb 5, 2023

I think this PR is good to go..
@sayakpaul @lhoestq

@sayakpaul sayakpaul merged commit c6e08fc into huggingface:main Feb 5, 2023
@github-actions
Copy link

github-actions bot commented Feb 5, 2023

Show benchmarks

PyArrow==6.0.0

Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.009064 / 0.011353 (-0.002289) 0.005262 / 0.011008 (-0.005746) 0.099608 / 0.038508 (0.061100) 0.035015 / 0.023109 (0.011906) 0.296501 / 0.275898 (0.020602) 0.353619 / 0.323480 (0.030139) 0.007903 / 0.007986 (-0.000083) 0.004093 / 0.004328 (-0.000235) 0.075260 / 0.004250 (0.071009) 0.043142 / 0.037052 (0.006089) 0.307755 / 0.258489 (0.049266) 0.336340 / 0.293841 (0.042499) 0.038596 / 0.128546 (-0.089950) 0.011861 / 0.075646 (-0.063786) 0.334226 / 0.419271 (-0.085045) 0.051472 / 0.043533 (0.007940) 0.298539 / 0.255139 (0.043400) 0.316856 / 0.283200 (0.033656) 0.108620 / 0.141683 (-0.033063) 1.434901 / 1.452155 (-0.017254) 1.468368 / 1.492716 (-0.024348)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.208402 / 0.018006 (0.190395) 0.445799 / 0.000490 (0.445309) 0.003704 / 0.000200 (0.003504) 0.000084 / 0.000054 (0.000030)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.025435 / 0.037411 (-0.011976) 0.105874 / 0.014526 (0.091348) 0.115652 / 0.176557 (-0.060905) 0.150872 / 0.737135 (-0.586263) 0.121705 / 0.296338 (-0.174633)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.397816 / 0.215209 (0.182607) 3.977766 / 2.077655 (1.900111) 1.850848 / 1.504120 (0.346728) 1.686062 / 1.541195 (0.144867) 1.786277 / 1.468490 (0.317787) 0.696250 / 4.584777 (-3.888527) 3.785255 / 3.745712 (0.039543) 3.355013 / 5.269862 (-1.914849) 1.818232 / 4.565676 (-2.747444) 0.085408 / 0.424275 (-0.338867) 0.012567 / 0.007607 (0.004960) 0.524185 / 0.226044 (0.298140) 5.061975 / 2.268929 (2.793047) 2.299866 / 55.444624 (-53.144758) 1.966709 / 6.876477 (-4.909768) 2.018760 / 2.142072 (-0.123313) 0.841341 / 4.805227 (-3.963886) 0.166374 / 6.500664 (-6.334290) 0.061854 / 0.075469 (-0.013615)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.221666 / 1.841788 (-0.620122) 14.373194 / 8.074308 (6.298886) 14.253614 / 10.191392 (4.062222) 0.172979 / 0.680424 (-0.507445) 0.029176 / 0.534201 (-0.505025) 0.447399 / 0.579283 (-0.131884) 0.443663 / 0.434364 (0.009299) 0.537071 / 0.540337 (-0.003267) 0.640539 / 1.386936 (-0.746397)
PyArrow==latest
Show updated benchmarks!

Benchmark: benchmark_array_xd.json

metric read_batch_formatted_as_numpy after write_array2d read_batch_formatted_as_numpy after write_flattened_sequence read_batch_formatted_as_numpy after write_nested_sequence read_batch_unformated after write_array2d read_batch_unformated after write_flattened_sequence read_batch_unformated after write_nested_sequence read_col_formatted_as_numpy after write_array2d read_col_formatted_as_numpy after write_flattened_sequence read_col_formatted_as_numpy after write_nested_sequence read_col_unformated after write_array2d read_col_unformated after write_flattened_sequence read_col_unformated after write_nested_sequence read_formatted_as_numpy after write_array2d read_formatted_as_numpy after write_flattened_sequence read_formatted_as_numpy after write_nested_sequence read_unformated after write_array2d read_unformated after write_flattened_sequence read_unformated after write_nested_sequence write_array2d write_flattened_sequence write_nested_sequence
new / old (diff) 0.007019 / 0.011353 (-0.004334) 0.005091 / 0.011008 (-0.005917) 0.074588 / 0.038508 (0.036080) 0.032391 / 0.023109 (0.009282) 0.340548 / 0.275898 (0.064650) 0.367159 / 0.323480 (0.043679) 0.005594 / 0.007986 (-0.002392) 0.004003 / 0.004328 (-0.000325) 0.073946 / 0.004250 (0.069695) 0.045921 / 0.037052 (0.008868) 0.340245 / 0.258489 (0.081756) 0.397958 / 0.293841 (0.104117) 0.036539 / 0.128546 (-0.092007) 0.012258 / 0.075646 (-0.063388) 0.087406 / 0.419271 (-0.331865) 0.049276 / 0.043533 (0.005743) 0.345235 / 0.255139 (0.090096) 0.361250 / 0.283200 (0.078050) 0.100757 / 0.141683 (-0.040926) 1.464644 / 1.452155 (0.012489) 1.545852 / 1.492716 (0.053136)

Benchmark: benchmark_getitem_100B.json

metric get_batch_of_1024_random_rows get_batch_of_1024_rows get_first_row get_last_row
new / old (diff) 0.222952 / 0.018006 (0.204945) 0.434607 / 0.000490 (0.434117) 0.000438 / 0.000200 (0.000238) 0.000060 / 0.000054 (0.000006)

Benchmark: benchmark_indices_mapping.json

metric select shard shuffle sort train_test_split
new / old (diff) 0.028834 / 0.037411 (-0.008577) 0.107523 / 0.014526 (0.092997) 0.122077 / 0.176557 (-0.054479) 0.156574 / 0.737135 (-0.580561) 0.122917 / 0.296338 (-0.173421)

Benchmark: benchmark_iterating.json

metric read 5000 read 50000 read_batch 50000 10 read_batch 50000 100 read_batch 50000 1000 read_formatted numpy 5000 read_formatted pandas 5000 read_formatted tensorflow 5000 read_formatted torch 5000 read_formatted_batch numpy 5000 10 read_formatted_batch numpy 5000 1000 shuffled read 5000 shuffled read 50000 shuffled read_batch 50000 10 shuffled read_batch 50000 100 shuffled read_batch 50000 1000 shuffled read_formatted numpy 5000 shuffled read_formatted_batch numpy 5000 10 shuffled read_formatted_batch numpy 5000 1000
new / old (diff) 0.417292 / 0.215209 (0.202083) 4.165980 / 2.077655 (2.088325) 1.996731 / 1.504120 (0.492611) 1.802946 / 1.541195 (0.261751) 1.878456 / 1.468490 (0.409966) 0.711035 / 4.584777 (-3.873742) 3.847357 / 3.745712 (0.101644) 2.088354 / 5.269862 (-3.181508) 1.344763 / 4.565676 (-3.220913) 0.086356 / 0.424275 (-0.337919) 0.012530 / 0.007607 (0.004923) 0.511693 / 0.226044 (0.285648) 5.126093 / 2.268929 (2.857165) 2.490023 / 55.444624 (-52.954602) 2.180274 / 6.876477 (-4.696202) 2.221511 / 2.142072 (0.079438) 0.836348 / 4.805227 (-3.968879) 0.169554 / 6.500664 (-6.331110) 0.064555 / 0.075469 (-0.010914)

Benchmark: benchmark_map_filter.json

metric filter map fast-tokenizer batched map identity map identity batched map no-op batched map no-op batched numpy map no-op batched pandas map no-op batched pytorch map no-op batched tensorflow
new / old (diff) 1.293466 / 1.841788 (-0.548321) 14.785700 / 8.074308 (6.711392) 13.858493 / 10.191392 (3.667101) 0.161777 / 0.680424 (-0.518646) 0.017794 / 0.534201 (-0.516407) 0.426286 / 0.579283 (-0.152997) 0.422517 / 0.434364 (-0.011847) 0.530777 / 0.540337 (-0.009560) 0.634822 / 1.386936 (-0.752114)

@awsaf49 awsaf49 deleted the nyu_depth_v2 branch March 23, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants