allenai / rslearn

A tool for developing remote sensing datasets and models.
Apache License 2.0
5 stars 0 forks source link

Add SAM2 pretrained image encoder as backbone #60

Closed yawenzzzz closed 1 month ago

yawenzzzz commented 1 month ago

SAM2 model weights here: https://console.cloud.google.com/storage/browser/rslearn-eai/artifacts/sam2?pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))&project=skylight-proto-1

favyen2 commented 1 month ago

Thanks for adding this! Can you apply the ruff formatting? It should be setup for pre-commit (pre-commit install) or manually run ruff check and ruff format.

yawenzzzz commented 1 month ago

Thanks for adding this! Can you apply the ruff formatting? It should be setup for pre-commit (pre-commit install) or manually run ruff check and ruff format.

Sure! Just applied the changes.

favyen2 commented 1 month ago

Is it possible to pip install sam2. It worked when I tried it but I see on the repository they say to install it from git repository, I'm not sure why.

yawenzzzz commented 1 month ago

Is it possible to pip install sam2. It worked when I tried it but I see on the repository they say to install it from git repository, I'm not sure why.

OK, let me test pip install sam2 see if it works same as from their git repo.

yawenzzzz commented 1 month ago

Is it possible to pip install sam2. It worked when I tried it but I see on the repository they say to install it from git repository, I'm not sure why.

OK, let me test pip install sam2 see if it works same as from their git repo.

I tried to use pip install, it stuck for more than 10min at Installing build dependencies

Step 10/13 : RUN pip install sam2
 ---> Running in 584a23cf18e5
Collecting sam2
  Downloading sam2-0.4.1.tar.gz (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.3/75.3 kB 496.4 kB/s eta 0:00:00
  Installing build dependencies: started

However, the following command given by their repo works smoothly, I have added them into Dockerfile

RUN git clone https://github.com/facebookresearch/segment-anything-2.git /opt/segment-anything-2
RUN pip install -e /opt/segment-anything-2
yawenzzzz commented 1 month ago

Is it possible to pip install sam2. It worked when I tried it but I see on the repository they say to install it from git repository, I'm not sure why.

OK, let me test pip install sam2 see if it works same as from their git repo.

I tried to use pip install, it stuck for more than 10min at Installing build dependencies

Step 10/13 : RUN pip install sam2
 ---> Running in 584a23cf18e5
Collecting sam2
  Downloading sam2-0.4.1.tar.gz (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.3/75.3 kB 496.4 kB/s eta 0:00:00
  Installing build dependencies: started

However, the following command given by their repo works smoothly, I have added them into Dockerfile

RUN git clone https://github.com/facebookresearch/segment-anything-2.git /opt/segment-anything-2
RUN pip install -e /opt/segment-anything-2

I also tried adding git+https://github.com/facebookresearch/segment-anything-2.git#egg=segment-anything-2 into extra_requirements.txt, but the regular pip install is not working well, throwing version conflicts. pip install -e works.