Team Ai
Apppublic

Arulkumar03/Fox_Sheep_Detector_Computer_Vision_model

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
INSTALL.md262 linesDownload Raw Back to detectron2
1## Installation2 3### Requirements4- Linux or macOS with Python ≥ 3.75- PyTorch ≥ 1.8 and [torchvision](https://github.com/pytorch/vision/) that matches the PyTorch installation.6  Install them together at [pytorch.org](https://pytorch.org) to make sure of this7- OpenCV is optional but needed by demo and visualization8 9 10### Build Detectron2 from Source11 12gcc & g++ ≥ 5.4 are required. [ninja](https://ninja-build.org/) is optional but recommended for faster build.13After having them, run:14```15python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'16# (add --user if you don't have permission)17 18# Or, to install it from a local clone:19git clone https://github.com/facebookresearch/detectron2.git20python -m pip install -e detectron221 22# On macOS, you may need to prepend the above commands with a few environment variables:23CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install ...24```25 26To __rebuild__ detectron2 that's built from a local clone, use `rm -rf build/ **/*.so` to clean the27old build first. You often need to rebuild detectron2 after reinstalling PyTorch.28 29### Install Pre-Built Detectron2 (Linux only)30 31Choose from this table to install [v0.6 (Oct 2021)](https://github.com/facebookresearch/detectron2/releases):32 33<table class="docutils"><tbody><th width="80"> CUDA </th><th valign="bottom" align="left" width="100">torch 1.10</th><th valign="bottom" align="left" width="100">torch 1.9</th><th valign="bottom" align="left" width="100">torch 1.8</th> <tr><td align="left">11.3</td><td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \34  https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html35</code></pre> </details> </td> <td align="left"> </td> <td align="left"> </td> </tr> <tr><td align="left">11.1</td><td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \36  https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.10/index.html37</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \38  https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.9/index.html39</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \40  https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.8/index.html41</code></pre> </details> </td> </tr> <tr><td align="left">10.2</td><td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \42  https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.10/index.html43</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \44  https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html45</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \46  https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.8/index.html47</code></pre> </details> </td> </tr> <tr><td align="left">10.1</td><td align="left"> </td> <td align="left"> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \48  https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.8/index.html49</code></pre> </details> </td> </tr> <tr><td align="left">cpu</td><td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \50  https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html51</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \52  https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html53</code></pre> </details> </td> <td align="left"><details><summary> install </summary><pre><code>python -m pip install detectron2 -f \54  https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.8/index.html55</code></pre> </details> </td> </tr></tbody></table>56 57Note that:581. The pre-built packages have to be used with corresponding version of CUDA and the official package of PyTorch.59   Otherwise, please build detectron2 from source.602. New packages are released every few months. Therefore, packages may not contain latest features in the main61   branch and may not be compatible with the main branch of a research project that uses detectron262   (e.g. those in [projects](projects)).63 64### Common Installation Issues65 66Click each issue for its solutions:67 68<details>69<summary>70Undefined symbols that looks like "TH..","at::Tensor...","torch..."71</summary>72<br/>73 74This usually happens when detectron2 or torchvision is not75compiled with the version of PyTorch you're running.76 77If the error comes from a pre-built torchvision, uninstall torchvision and pytorch and reinstall them78following [pytorch.org](http://pytorch.org). So the versions will match.79 80If the error comes from a pre-built detectron2, check [release notes](https://github.com/facebookresearch/detectron2/releases),81uninstall and reinstall the correct pre-built detectron2 that matches pytorch version.82 83If the error comes from detectron2 or torchvision that you built manually from source,84remove files you built (`build/`, `**/*.so`) and rebuild it so it can pick up the version of pytorch currently in your environment.85 86If the above instructions do not resolve this problem, please provide an environment (e.g. a dockerfile) that can reproduce the issue.87</details>88 89<details>90<summary>91Missing torch dynamic libraries, OR segmentation fault immediately when using detectron2.92</summary>93This usually happens when detectron2 or torchvision is not94compiled with the version of PyTorch you're running. See the previous common issue for the solution.95</details>96 97<details>98<summary>99Undefined C++ symbols (e.g. "GLIBCXX..") or C++ symbols not found.100</summary>101<br/>102Usually it's because the library is compiled with a newer C++ compiler but run with an old C++ runtime.103 104This often happens with old anaconda.105It may help to run `conda update libgcc` to upgrade its runtime.106 107The fundamental solution is to avoid the mismatch, either by compiling using older version of C++108compiler, or run the code with proper C++ runtime.109To run the code with a specific C++ runtime, you can use environment variable `LD_PRELOAD=/path/to/libstdc++.so`.110 111</details>112 113<details>114<summary>115"nvcc not found" or "Not compiled with GPU support" or "Detectron2 CUDA Compiler: not available".116</summary>117<br/>118CUDA is not found when building detectron2.119You should make sure120 121```122python -c 'import torch; from torch.utils.cpp_extension import CUDA_HOME; print(torch.cuda.is_available(), CUDA_HOME)'123```124 125print `(True, a directory with cuda)` at the time you build detectron2.126 127Most models can run inference (but not training) without GPU support. To use CPUs, set `MODEL.DEVICE='cpu'` in the config.128</details>129 130<details>131<summary>132"invalid device function" or "no kernel image is available for execution".133</summary>134<br/>135Two possibilities:136 137* You build detectron2 with one version of CUDA but run it with a different version.138 139  To check whether it is the case,140  use `python -m detectron2.utils.collect_env` to find out inconsistent CUDA versions.141  In the output of this command, you should expect "Detectron2 CUDA Compiler", "CUDA_HOME", "PyTorch built with - CUDA"142  to contain cuda libraries of the same version.143 144  When they are inconsistent,145  you need to either install a different build of PyTorch (or build by yourself)146  to match your local CUDA installation, or install a different version of CUDA to match PyTorch.147 148* PyTorch/torchvision/Detectron2 is not built for the correct GPU SM architecture (aka. compute capability).149 150  The architecture included by PyTorch/detectron2/torchvision is available in the "architecture flags" in151  `python -m detectron2.utils.collect_env`. It must include152  the architecture of your GPU, which can be found at [developer.nvidia.com/cuda-gpus](https://developer.nvidia.com/cuda-gpus).153 154  If you're using pre-built PyTorch/detectron2/torchvision, they have included support for most popular GPUs already.155  If not supported, you need to build them from source.156 157  When building detectron2/torchvision from source, they detect the GPU device and build for only the device.158  This means the compiled code may not work on a different GPU device.159  To recompile them for the correct architecture, remove all installed/compiled files,160  and rebuild them with the `TORCH_CUDA_ARCH_LIST` environment variable set properly.161  For example, `export TORCH_CUDA_ARCH_LIST="6.0;7.0"` makes it compile for both P100s and V100s.162</details>163 164<details>165<summary>166Undefined CUDA symbols; Cannot open libcudart.so167</summary>168<br/>169The version of NVCC you use to build detectron2 or torchvision does170not match the version of CUDA you are running with.171This often happens when using anaconda's CUDA runtime.172 173Use `python -m detectron2.utils.collect_env` to find out inconsistent CUDA versions.174In the output of this command, you should expect "Detectron2 CUDA Compiler", "CUDA_HOME", "PyTorch built with - CUDA"175to contain cuda libraries of the same version.176 177When they are inconsistent,178you need to either install a different build of PyTorch (or build by yourself)179to match your local CUDA installation, or install a different version of CUDA to match PyTorch.180</details>181 182 183<details>184<summary>185C++ compilation errors from NVCC / NVRTC, or "Unsupported gpu architecture"186</summary>187<br/>188A few possibilities:189 1901. Local CUDA/NVCC version has to match the CUDA version of your PyTorch. Both can be found in `python collect_env.py`191   (download from [here](./detectron2/utils/collect_env.py)).192   When they are inconsistent, you need to either install a different build of PyTorch (or build by yourself)193   to match your local CUDA installation, or install a different version of CUDA to match PyTorch.194 1952. Local CUDA/NVCC version shall support the SM architecture (a.k.a. compute capability) of your GPU.196   The capability of your GPU can be found at [developer.nvidia.com/cuda-gpus](https://developer.nvidia.com/cuda-gpus).197   The capability supported by NVCC is listed at [here](https://gist.github.com/ax3l/9489132).198   If your NVCC version is too old, this can be workaround by setting environment variable199   `TORCH_CUDA_ARCH_LIST` to a lower, supported capability.200 2013. The combination of NVCC and GCC you use is incompatible. You need to change one of their versions.202   See [here](https://gist.github.com/ax3l/9489132) for some valid combinations.203   Notably, CUDA<=10.1.105 doesn't support GCC>7.3.204 205   The CUDA/GCC version used by PyTorch can be found by `print(torch.__config__.show())`.206 207</details>208 209 210<details>211<summary>212"ImportError: cannot import name '_C'".213</summary>214<br/>215Please build and install detectron2 following the instructions above.216 217Or, if you are running code from detectron2's root directory, `cd` to a different one.218Otherwise you may not import the code that you installed.219</details>220 221 222<details>223<summary>224Any issue on windows.225</summary>226<br/>227 228Detectron2 is continuously built on windows with [CircleCI](https://app.circleci.com/pipelines/github/facebookresearch/detectron2?branch=main).229However we do not provide official support for it.230PRs that improves code compatibility on windows are welcome.231</details>232 233<details>234<summary>235ONNX conversion segfault after some "TraceWarning".236</summary>237<br/>238The ONNX package is compiled with a too old compiler.239 240Please build and install ONNX from its source code using a compiler241whose version is closer to what's used by PyTorch (available in `torch.__config__.show()`).242</details>243 244 245<details>246<summary>247"library not found for -lstdc++" on older version of MacOS248</summary>249<br/>250 251See [this stackoverflow answer](https://stackoverflow.com/questions/56083725/macos-build-issues-lstdc-not-found-while-building-python-package).252 253</details>254 255 256### Installation inside specific environments:257 258* __Colab__: see our [Colab Tutorial](https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5)259  which has step-by-step instructions.260 261* __Docker__: The official [Dockerfile](docker) installs detectron2 with a few simple commands.262