Arulkumar03/Wheat_HEAD_Detection_Counting_ComputerVision_Model
0
1version: 2.12 3# -------------------------------------------------------------------------------------4# Environments to run the jobs in5# -------------------------------------------------------------------------------------6cpu: &cpu7 machine:8 image: ubuntu-2004:202107-029 resource_class: medium10 11gpu: &gpu12 machine:13 # NOTE: use a cuda version that's supported by all our pytorch versions14 image: ubuntu-1604-cuda-11.1:202012-0115 resource_class: gpu.nvidia.small16 17windows-cpu: &windows_cpu18 machine:19 resource_class: windows.medium20 image: windows-server-2019-vs2019:stable21 shell: powershell.exe22 23# windows-gpu: &windows_gpu24# machine:25# resource_class: windows.gpu.nvidia.medium26# image: windows-server-2019-nvidia:stable27 28version_parameters: &version_parameters29 parameters:30 pytorch_version:31 type: string32 torchvision_version:33 type: string34 pytorch_index:35 type: string36 # use test wheels index to have access to RC wheels37 # https://download.pytorch.org/whl/test/torch_test.html38 default: "https://download.pytorch.org/whl/torch_stable.html"39 python_version: # NOTE: only affect linux40 type: string41 default: '3.8.6'42 43 environment:44 PYTORCH_VERSION: << parameters.pytorch_version >>45 TORCHVISION_VERSION: << parameters.torchvision_version >>46 PYTORCH_INDEX: << parameters.pytorch_index >>47 PYTHON_VERSION: << parameters.python_version>>48 # point datasets to ~/.torch so it's cached in CI49 DETECTRON2_DATASETS: ~/.torch/datasets50 51# -------------------------------------------------------------------------------------52# Re-usable commands53# -------------------------------------------------------------------------------------54# install_nvidia_driver: &install_nvidia_driver55# - run:56# name: Install nvidia driver57# working_directory: ~/58# command: |59# wget -q 'https://s3.amazonaws.com/ossci-linux/nvidia_driver/NVIDIA-Linux-x86_64-430.40.run'60# sudo /bin/bash ./NVIDIA-Linux-x86_64-430.40.run -s --no-drm61# nvidia-smi62 63add_ssh_keys: &add_ssh_keys64 # https://circleci.com/docs/2.0/add-ssh-key/65 - add_ssh_keys:66 fingerprints:67 - "e4:13:f2:22:d4:49:e8:e4:57:5a:ac:20:2f:3f:1f:ca"68 69install_python: &install_python70 - run:71 name: Install Python72 working_directory: ~/73 command: |74 # upgrade pyenv75 cd /opt/circleci/.pyenv/plugins/python-build/../.. && git pull && cd -76 pyenv install -s $PYTHON_VERSION77 pyenv global $PYTHON_VERSION78 python --version79 which python80 pip install --upgrade pip81 82setup_venv: &setup_venv83 - run:84 name: Setup Virtual Env85 working_directory: ~/86 command: |87 python -m venv ~/venv88 echo ". ~/venv/bin/activate" >> $BASH_ENV89 . ~/venv/bin/activate90 python --version91 which python92 which pip93 pip install --upgrade pip94 95setup_venv_win: &setup_venv_win96 - run:97 name: Setup Virtual Env for Windows98 command: |99 pip install virtualenv100 python -m virtualenv env101 .\env\Scripts\activate102 python --version103 which python104 which pip105 106install_linux_dep: &install_linux_dep107 - run:108 name: Install Dependencies109 command: |110 # disable crash coredump, so unittests fail fast111 sudo systemctl stop apport.service112 # install from github to get latest; install iopath first since fvcore depends on it113 pip install --progress-bar off -U 'git+https://github.com/facebookresearch/iopath'114 pip install --progress-bar off -U 'git+https://github.com/facebookresearch/fvcore'115 # Don't use pytest-xdist: cuda tests are unstable under multi-process workers.116 # Don't use opencv 4.7.0.68: https://github.com/opencv/opencv-python/issues/765117 pip install --progress-bar off ninja opencv-python-headless!=4.7.0.68 pytest tensorboard pycocotools onnx118 pip install --progress-bar off torch==$PYTORCH_VERSION -f $PYTORCH_INDEX119 if [[ "$TORCHVISION_VERSION" == "master" ]]; then120 pip install git+https://github.com/pytorch/vision.git121 else122 pip install --progress-bar off torchvision==$TORCHVISION_VERSION -f $PYTORCH_INDEX123 fi124 125 python -c 'import torch; print("CUDA:", torch.cuda.is_available())'126 gcc --version127 128install_detectron2: &install_detectron2129 - run:130 name: Install Detectron2131 command: |132 # Remove first, in case it's in the CI cache133 pip uninstall -y detectron2134 135 pip install --progress-bar off -e .[all]136 python -m detectron2.utils.collect_env137 ./datasets/prepare_for_tests.sh138 139run_unittests: &run_unittests140 - run:141 name: Run Unit Tests142 command: |143 pytest -sv --durations=15 tests # parallel causes some random failures144 145uninstall_tests: &uninstall_tests146 - run:147 name: Run Tests After Uninstalling148 command: |149 pip uninstall -y detectron2150 # Remove built binaries151 rm -rf build/ detectron2/*.so152 # Tests that code is importable without installation153 PYTHONPATH=. ./.circleci/import-tests.sh154 155 156# -------------------------------------------------------------------------------------157# Jobs to run158# -------------------------------------------------------------------------------------159jobs:160 linux_cpu_tests:161 <<: *cpu162 <<: *version_parameters163 164 working_directory: ~/detectron2165 166 steps:167 - checkout168 169 # Cache the venv directory that contains python, dependencies, and checkpoints170 # Refresh the key when dependencies should be updated (e.g. when pytorch releases)171 - restore_cache:172 keys:173 - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827174 175 - <<: *install_python176 - <<: *install_linux_dep177 - <<: *install_detectron2178 - <<: *run_unittests179 - <<: *uninstall_tests180 181 - save_cache:182 paths:183 - /opt/circleci/.pyenv184 - ~/.torch185 key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827186 187 188 linux_gpu_tests:189 <<: *gpu190 <<: *version_parameters191 192 working_directory: ~/detectron2193 194 steps:195 - checkout196 197 - restore_cache:198 keys:199 - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827200 201 - <<: *install_python202 - <<: *install_linux_dep203 - <<: *install_detectron2204 - <<: *run_unittests205 - <<: *uninstall_tests206 207 - save_cache:208 paths:209 - /opt/circleci/.pyenv210 - ~/.torch211 key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827212 213 windows_cpu_build:214 <<: *windows_cpu215 <<: *version_parameters216 steps:217 - <<: *add_ssh_keys218 - checkout219 - <<: *setup_venv_win220 221 # Cache the env directory that contains dependencies222 - restore_cache:223 keys:224 - cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404225 226 - run:227 name: Install Dependencies228 command: |229 pip install certifi --ignore-installed # required on windows to workaround some cert issue230 pip install numpy cython # required on windows before pycocotools231 pip install opencv-python-headless pytest-xdist pycocotools tensorboard onnx232 pip install -U git+https://github.com/facebookresearch/iopath233 pip install -U git+https://github.com/facebookresearch/fvcore234 pip install torch==$env:PYTORCH_VERSION torchvision==$env:TORCHVISION_VERSION -f $env:PYTORCH_INDEX235 236 - save_cache:237 paths:238 - env239 key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404240 241 - <<: *install_detectron2242 # TODO: unittest fails for now243 244workflows:245 version: 2246 regular_test:247 jobs:248 - linux_cpu_tests:249 name: linux_cpu_tests_pytorch1.10250 pytorch_version: '1.10.0+cpu'251 torchvision_version: '0.11.1+cpu'252 - linux_gpu_tests:253 name: linux_gpu_tests_pytorch1.8254 pytorch_version: '1.8.1+cu111'255 torchvision_version: '0.9.1+cu111'256 - linux_gpu_tests:257 name: linux_gpu_tests_pytorch1.9258 pytorch_version: '1.9+cu111'259 torchvision_version: '0.10+cu111'260 - linux_gpu_tests:261 name: linux_gpu_tests_pytorch1.10262 pytorch_version: '1.10+cu111'263 torchvision_version: '0.11.1+cu111'264 - linux_gpu_tests:265 name: linux_gpu_tests_pytorch1.10_python39266 pytorch_version: '1.10+cu111'267 torchvision_version: '0.11.1+cu111'268 python_version: '3.9.6'269 - windows_cpu_build:270 pytorch_version: '1.10+cpu'271 torchvision_version: '0.11.1+cpu'272 