facebookresearch / facebookresearch/detectron2

Installing detectron2 installs a seperate tools package. Instead of adding it to detectron2 like projects

Open
#5,205 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34.7k
Forks
7.9k
PR merge metrics
No merged PRs in 30d

Description

## Instructions To Reproduce the Issue:
Minimal conda environment file:
```yaml
name: example
channels:
- pytorch
- nvidia
- conda-forge
dependencies:
- python=3
- pytorch
- torchvision
- cuda-toolkit
- pip
- pip:
- "git+https://github.com/facebookresearch/detectron2.git"
```

Install Environment
```sh
conda env create -f environment.yaml
```
Open python shell
```sh
python
```
Verify that the tools has become a separate package:
```py
import tools

help(tools)
```
Output on my machine:
```
NAME
tools

PACKAGE CONTENTS
analyze_model
benchmark
convert-torchvision-to-d2
lazyconfig_train_net
lightning_train_net
plain_train_net
train_net
visualize_data
visualize_json_results

FILE
/home/stefan/.mambaforge/envs/example/lib/python3.12/site-packages/tools/__init__.py
```
## Expected behavior:
Add tools to the detectron2 package in the same way projects is added. Presumably here: https://github.com/facebookresearch/detectron2/blob/b7ff9466d174fbb7061ff6d3773cd9c372a8e56f/setup.py#L145-L149 . Or add it in the excluded packages: https://github.com/facebookresearch/detectron2/blob/b7ff9466d174fbb7061ff6d3773cd9c372a8e56f/setup.py#L158

Expected import:
```py
import detectron2.tools
```

## Environment:

------------------------------- --------------------------------------------------------------------------------------
sys.platform linux
Python 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 08:03:24) [GCC 12.3.0]
numpy 1.26.3
detectron2 0.6 @/home/stefan/.mambaforge/envs/example/lib/python3.12/site-packages/detectron2
Compiler GCC 11.4
CUDA compiler CUDA 12.1
detectron2 arch flags 8.6
DETECTRON2_ENV_MODULE
PyTorch 2.2.0 @/home/stefan/.mambaforge/envs/example/lib/python3.12/site-packages/torch
PyTorch debug build False
torch._C._GLIBCXX_USE_CXX11_ABI False
GPU available Yes
GPU 0 NVIDIA GeForce RTX 3080 Ti Laptop GPU (arch=8.6)
Driver version 535.154.05
CUDA_HOME /home/stefan/.mambaforge/envs/example
Pillow 10.2.0
torchvision 0.17.0 @/home/stefan/.mambaforge/envs/example/lib/python3.12/site-packages/torchvision
torchvision arch flags 5.0, 6.0, 7.0, 7.5, 8.0, 8.6, 9.0
fvcore 0.1.5.post20221221
iopath 0.1.9
cv2 Not found
------------------------------- --------------------------------------------------------------------------------------
PyTorch built with:
- GCC 9.3
- C++ Version: 201703
- Intel(R) oneAPI Math Kernel Library Version 2022.1-Product Build 20220311 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v3.3.2 (Git Hash 2dc95a2ad0841e29db8b22fbccaf3e5da7992b01)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX2
- CUDA Runtime 12.1
- NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90
- CuDNN 8.9.2
- Magma 2.6.1
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=8.9.2, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.2.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

Contributor guide

Open the contributing guide

Research direction

Reproduce the installation from the provided environment.yaml and inspect setup.py at the referenced package-discovery and excluded-package sections. Check how projects is included, then verify that the tools modules are available through detectron2.tools rather than as a separate tools package. Done means the expected import works after installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.