Files
HuggingFace_transformer/docs/source/en/model_doc
Armaghan Shakir 9a6be63fdb Add Apple's Depth-Pro for depth estimation (#34583)
* implement config and model building blocks

* refactor model architechture

* update model outputs

* update init param to include use_fov_model

* update param name in config

* fix hidden_states and attentions outputs for fov

* sort config

* complete minor todos

* update patching

* update config for encoder

* fix config

* use correct defaults in config

* update merge for compatibility with different image size

* restructure encoder for custom configuration

* make fov model compatible with custom config

* replace word "decoder" with "fusion"

* weight conversion script

* fix fov squeeze

* update conversion script (without test)

* upload ruff image processing

* create fast image processing

* use torch interpolation for image processing

* complete post_process_depth_estimation

* config: fix imports and sort args

* apply inference in weight conversion

* use mllama script instead for weight conversion

* clean weight conversion script

* add depth-pro status in other files

* fill docstring in config

* formatting

* more formatting

* formatting with ruff

* formatting with style

* fix copied classes

* add examples; update weight convert script

* fix using check_table.py and isort

* fix config docstring

* add depth pro to sdpa docs

* undo unintentional changes in configuration_gemma.py

* minor fixes

* test image processing

* fixes and tests

* more fixes

* use output states from image_encoder instead

* Revert "use output states from image_encoder instead"

This reverts commit 2408ec54e4f27d2abbecdb8374e58f34d91d8e96.

* make embeddings dynamic

* reshape output hidden states and attentions as part of computation graph

* fix ruff formating

* fix docstring failure

* use num_fov_head_layers in tests

* update doc

* check consistency with config

* ruff formatting

* update test case

* fix ruff formatting

* add tests for fov

* use interpolation in postprocess

* run and fix slow tests locally

* use scaled_images_features for image and fov encoder

* return fused_hidden_states in fusion stage

* fix example

* fix ruff

* fix copyright license for all files

* add __all__ for each file

* minor fixes
- fix download spell
- add push_to_hub option
- fix Optional type hinting
- apply single loop for DepthProImageProcessor.preprocess

* return list in post_process_depth_estimation

* minor fixes
- capitalize start of docstring
- use ignore copy
- fix examples
- move docstring templates and custom output classes to top
- remove "-> None" typehinting from __init__
- type hinting for forward passes
- fix docstrings for custom output classes

* fix "ruff check"

* update upsample and projection

* major changes: (image size and merge optimization)
- add support for images of any size
- optimize merge operation
- remove image_size from config
- use full names instead of B, C, H, W
- remove interpolation from fusion stage
- add interpolation after merge
- move validations to config
- update integration test
- add type hints for functions

* fix push_to_hub option in weights conversion

* remove image_size in weights conversion

* major changes in the architecture
- remove all DepthProViT modules and support different backbones using the AutoModel API
- set default use_fov_model to False
- validate parameters in configuration
- update interpolate function: use "nearest" for faster computation
- update reshape_feature function: remove all special tokens, possible from different backbones
- update merge function: use padding from config instead of merge_out_size
- remove patch_to_batch and batch_to_patch conversions for now
- calculate out_size dynamically in the encoder
- leave head_mask calculation to the backbone
- fix bugs with merge
- add more comments
- update tests

* placeholder for unused config attributes

* improve docs amid review

* minor change in docs

* further optimize merge

* fix formatting

* remove unused patch/batch convertion functions

* use original F.interpolate

* improve function naming

* minor chages
- use torch_int instead of int
- use proper for newly initialized tensors
- use user provided return_dict for patch_encoder
- use if-else block instead in self.use_fov_model

* rearchitect upsample block for improved modularity

* update upsample keys in weight conversion

* improve padding in merge_patches

* use double-loop for merge

* update comments

* create feature_extractor, reduce some forward code

* introduce config.use_mask_token in dinov2

* minor fixes

* minor fixes for onnx

* update __init__ to latest format

* remove DepthProConfig.to_dict()

* major changes in backbone

* update config in weight conversion

* formatting

* converted model is fp32

* improve naming and docs for feature_extractor->reconstruct_feature_maps

* minor fixes; amid review

* create intermediate vars in func call

* use torch.testing.assert_close

* use ModuleList instead of Sequential and ModuleDict

* update docs

* include fov in integraiton tests

* update docs

* improve initialization of convolution layers

* fix unused fov keys

* update tests

* ruff format

* fix test, amid kaimming initialization

* add depthpro to toctree

* add residual layer to _no_split_modules

* architecture rework

* Update src/transformers/models/depth_pro/image_processing_depth_pro.py

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* Update src/transformers/models/depth_pro/image_processing_depth_pro_fast.py

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* update docs

* improve merge_patches

* use flatten with fov_output

* ruff formatting

* update resources section in docs

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* fix typo "final_kernal_size"

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* fix output typehint for DepthProDepthEstimator

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* residual operation in 2 steps

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>

* use image_size instead of global patch_size in interpolation

* replace all Sequential with ModuleList

* update fov

* update heads

* fix and update conversion script for heads

* ruff formatting

* remove float32 conversion

* use "Fov" instead of "FOV" in class names

* use "Fov" instead of "FOV" in config docs

* remove prune_heads

* update fusion stage

* use device in examples

* update processor

* ruff fixes

* add do_rescale in image_processor_dict

* skip test: test_fast_is_faster_than_slow

* ruff formatting

* DepthProImageProcessorFast in other files

* revert antialias removal

* add antialias in BaseImageProcessorFast

* Revert "revert antialias removal"

This reverts commit 5caa0bd8f9f7463b98410c04e6cfe8fef3adee18.

* Revert "add antialias in BaseImageProcessorFast"

This reverts commit 3ae1134780ae236872985523d9c0a444eabcc179.

* update processor for grouping and antialias

* try test_fast_is_faster_than_slow without "skip" or "flanky"

* update checkpoint

* update checkpoint

* use @is_flanky for processor test

* update checkpoint to "apple/DepthPro-hf"

---------

Co-authored-by: Pavel Iakubovskii <qubvel@gmail.com>
2025-02-10 11:32:45 +00:00
..
2024-09-03 14:01:00 +01:00
2024-12-06 12:17:34 +01:00
2024-12-18 20:18:17 +01:00
2024-12-17 14:44:47 +01:00
2024-04-26 16:23:44 +01:00
2024-09-20 14:27:32 +01:00
2023-11-06 19:45:03 +00:00
2023-11-10 13:49:10 +00:00
2024-12-17 09:36:31 -08:00
2024-03-15 14:29:11 +01:00
2024-08-19 10:21:51 +01:00
2024-12-17 14:44:47 +01:00
2024-05-28 18:07:07 +01:00
2024-10-21 09:05:05 -04:00
2025-01-07 11:34:56 +01:00
2024-08-19 09:28:13 +01:00
2024-10-02 13:55:19 +01:00
2023-11-23 17:44:08 +00:00
2025-01-20 11:15:39 +01:00
2024-05-28 18:07:07 +01:00
2024-12-17 14:23:13 +01:00
2024-08-07 10:03:05 +05:00
2025-01-26 15:26:38 -08:00
2024-06-19 09:40:57 +02:00
2024-08-27 21:27:21 +02:00
2024-09-21 01:43:50 +02:00
2025-01-26 15:26:38 -08:00
2025-01-13 18:41:15 +01:00
2024-12-06 12:17:34 +01:00
2024-05-13 15:59:46 +01:00
2024-12-09 10:01:31 +01:00
2024-05-14 16:32:01 +02:00
2024-05-28 18:07:07 +01:00
2023-10-30 21:42:19 +01:00
2023-12-20 14:25:07 +05:30
2024-08-26 17:49:44 +02:00
2024-05-28 18:07:07 +01:00
2024-10-16 11:21:49 +02:00
2024-10-30 10:11:50 +01:00
2025-01-09 20:15:38 +01:00
2025-01-10 11:00:54 +01:00
2025-01-26 15:26:38 -08:00
2024-05-28 18:07:07 +01:00
2024-08-06 15:42:05 +02:00
2024-05-28 18:07:07 +01:00
2024-09-25 18:04:42 +01:00
2024-04-17 17:59:07 +02:00
2024-09-05 15:49:28 +02:00
2024-10-10 11:49:34 +02:00
2024-02-19 15:22:29 +01:00
2024-02-19 15:22:29 +01:00
2025-01-26 15:26:38 -08:00
2024-10-04 21:39:45 +02:00
2024-03-13 19:05:20 +00:00
2024-05-28 18:07:07 +01:00
2025-01-23 11:23:00 +01:00
2024-05-28 18:07:07 +01:00
2023-11-06 19:45:03 +00:00
2023-07-13 11:46:54 -04:00
2025-01-26 15:26:38 -08:00
2025-01-26 15:26:38 -08:00
2025-01-20 10:32:39 +00:00
2024-04-19 18:31:43 +01:00
2023-11-06 19:45:03 +00:00
2025-01-08 09:52:51 +01:00
2024-05-28 18:07:07 +01:00
2023-11-23 17:02:16 +00:00
2024-06-11 15:47:38 +01:00
2024-10-15 11:27:54 +02:00
2024-05-28 18:07:07 +01:00
2025-01-27 11:44:10 -08:00
2024-10-04 22:28:05 +02:00
2025-01-26 15:26:38 -08:00