SHI-Labs / OneFormer

OneFormer: One Transformer to Rule Universal Image Segmentation, arxiv 2022 / CVPR 2023
https://praeclarumjj3.github.io/oneformer
MIT License
1.51k stars 134 forks source link

Installation Issues with Detectron2 #90

Closed SouLeo closed 1 year ago

SouLeo commented 1 year ago

Hello, I followed the provided install instructions here: https://github.com/SHI-Labs/OneFormer/blob/main/INSTALL.md

However, I have come across multiple compatibility issues with this approach for installing Detectron2 with the tools/setup_detectron.py script.

First, this installation method nests two directories named "detectron2" within each other which confuses some of the imports in the provided train_net.py code. I have found that I needed to copy the contents within the most nested detectron2 directory into the directory directly above it to have the imports work.

Another issue I have run across is the point_rend imports are broken as well. For example: https://github.com/SHI-Labs/OneFormer/blob/4962ef6a96ffb76a76771bfa3e8b3587f209752b/oneformer/modeling/matcher.py#L16

The import, with the current detectron2 install (https://github.com/facebookresearch/detectron2/commit/45b3fcea6e76bf7a351e54e01c7d6e1a3a0100a5), should look like from detectron2.projects.PointRend.point_rend.point_features import point_sample

To be honest, I still don't have this working with detectron2 yet, but I want to begin cataloging some compatibility issues I've been having.

SouLeo commented 1 year ago

I have solved this issue. I had difficulties actually building the detectron2 packages through the installation guide provided.

But when I followed the detectron2 installation instructions from the actual repo's documentation I was able to finally build.

Specifically, this step was necessary: python -m pip install -e detectron2

Once I did a fresh install and build, I didn't need to move around any of the file name to fix imports. It just worked.