Please check INSTALL.md for installation instructions.
Follow the instructions to install dependencies. See Troubleshooting for known issues.
-
Install basic libraries.
conda create -n srdatagen python=3.10 conda activate srdatagen # Install PyTorch pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121 # Install mmengine pip install -U openmim mim install mmengine # Other libraries pip install iopath pyequilib==0.3.0 albumentations einops open3d imageio yacs transforms3d pip install mmcv==2.2.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.3/index.html
-
Install
Grounded-Segment-Anything.git clone https://github.com/IDEA-Research/Grounded-Segment-Anything.git cd Grounded-Segment-Anything/ python -m pip install -e segment_anything pip install --no-build-isolation -e GroundingDINO -
Install
SAM2. Update./sam-hq/sam-hq2/setup.pyand./sam-hq/sam-hq2/pyproject.tomlaccordingly so it does not overwrite your PyTorch setup.git clone https://github.com/SysCV/sam-hq.git cd sam-hq/sam-hq2 pip install -e .
-
Install
Depth-Anything-V2. We only need the code in reference import.git clone https://github.com/DepthAnything/Depth-Anything-V2.git
-
Install
recognize-anything.git clone https://github.com/xinyu1205/recognize-anything.git pip install -r ./recognize-anything/requirements.txt pip install setuptools --upgrade pip install -e ./recognize-anything/
-
Install
PerspectiveFields. We only need the code in reference import.git clone https://github.com/jinlinyi/PerspectiveFields.git
-
Download pretrained weights.
wget https://huggingface.co/spaces/xinyu1205/Tag2Text/resolve/main/ram_swin_large_14m.pth -P pretrained_weights wget https://huggingface.co/xinyu1205/recognize-anything-plus-model/resolve/main/ram_plus_swin_large_14m.pth -P pretrained_weights wget https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth -P pretrained_weights wget https://huggingface.co/lkeab/hq-sam/resolve/main/sam2.1_hq_hiera_large.pt -P pretrained_weights wget https://huggingface.co/Viglong/Orient-Anything/resolve/main/croplargeEX2/dino_weight.pt -P pretrained_weights
-
Install
srdatagen.pip install -e .
-
Getting
GlobalHydranot initialized error when buildingSAM2:AssertionError: GlobalHydra is not initialized, use @hydra.main() or call one of the hydra initialization methods firstUpdate the
build_sam2function insam-hq/sam-hq2/sam2/build_sam.pywithhydra.initialize:def build_sam2(...): ... # Read config and init model from hydra import initialize with initialize(version_base=None, config_path='configs', job_name='srdatagen'): cfg = compose(config_name=config_file, overrides=hydra_overrides_extra) ...
Also update the config:
sam_cfg.cfg_path = 'sam2.1/sam2.1_hq_hiera_l.yaml'
-
Error when installing
GroundingDINO.ERROR: Project file:///home/xxx/GroundingDINO uses a build backend that is missing the 'build_editable' hook, so it cannot be installed in editable mode. Consider using a build backend that supports PEP 660.
Upgrade
pipandsetuptools:pip install --upgrade pip setuptools
-
Cannot import
apply_chunking_to_forward. Need to downgradetransformers, e.g.,pip install transformers==4.52.3