Open SaiAakash opened 1 week ago
Hello, I encountered the same issue as the conda.yaml file uses old pytorch and cuda version. When compiling old cuda old gcc and g++ are required and not easy to install. For instance we need gcc-8 to compile with cuda 10.2 but it was discontinued in ubuntu 22.04 (it has gcc-11). A better way is to simply install a newer pytorch version with newer cuda. I tried with pytorch 2.3 with cuda 12.1 as I used a similar environement to test SAM2 and it worked. Here is the recipe to reproduce a working environement :
# first make sure you installed cudatoolkit 12.1 on your machine
# use sudo update-alternatives --config cuda to make sure to select cuda 12.1 when multiple cuda version are installed
# create conda env
conda create -n coralscop python=3.10
# install pytorch with cuda 12.1
pip install torch==2.3.0 torchvision==0.18.0 --index-url https://download.pytorch.org/whl/cu121
pip install opencv-python
# install and compile detectron2
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
Using this environement I was able to execute both inference and visualization scripts
In general, using the conda.yaml file to reproduce a working env is not ideal and has many caveats. A better way is to provide installation instructions and major package dependencies. A docker build is also a nice to have. I can ake a pull request to add one if needed.
@taiamiti That would be nice to have, in my case, I have to edit the coral.yml file because mmcv-full is unable to detect the $CUDA_HOME variable so I removed that and then I had to change the pycocotools to 2.0.8. The tricky parts of installing could be avoided with a dockerfile BTW the author should provide a yml file with builds and prefixes
I have tested the coral.yaml
file in Ubuntu 20.04.
It usually leads to some errors when installing the pycocotools in Windows. I have tested pycocotools-windows==2.0.0 in Windows and it works for me.
As for the detectron2, we used that visualization codes to better visualize the boundary. You can skip this dependence and could just utilize the pycocotools to generate the coral reef masks instead using following codes:
import pycocotools.mask as mask
coral_mask=mask.decode(ann["segmentation"])
I will upload corresponding visualization scripts soon.
In general, using the conda.yaml file to reproduce a working env is not ideal and has many caveats. A better way is to provide installation instructions and major package dependencies. A docker build is also a nice to have. I can ake a pull request to add one if needed.
Thank you for your help! I will also try to solve this problem. I used an older pytorch version since I used pytorch-lightning
for training. Please feel free to add your pull request.
Thanks for all the suggestions ! I was able to run CoralSCOP by making some changes on the lines of what @D-Barradas and @taiamiti suggested. For me things were slightly different because, apart from the pycocotools error, my conda environment was unable to detect the cuda-toolkit installed inside my environment (which doesn't generally contain things like nvcc). However, I fixed this by installing cudatoolkit-dev
with conda and set my CUDA_HOME
env variable to the nvcc inside the conda environment.
This solved the issue for me. It's also a general solution to safely play with multiple cuda-toolkit versions if that's an unavoidable requirement.
Hi @zhengziqiang ! This is great work !
I tried to setup the environment and run the CoralSCOP model. There were a few issues with the installation initially which I managed and got it to work. I was able to run test.py and generate the output json files. However, when I tried to run the visualizer.py I was not able to visualize the masks and the images because of detectron2 missing from my environment.
I tried to install detectron2 but I couldn't and got the following error:
The traceback was much bigger, I have posted only the last few lines of it. Is this dependency a mandatory one or could we get around with some other package to visualize the masks ?