File size: 892 Bytes
e8b8483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Filesystem and repository locations, overridable by environment.

BACKBONE      HF repo id or local path for the backbone wrapper (alias: ARGUS_PATH)
BACKBONE_SRC  local directory supplying argus.py (alias: ARGUS_SRC)
COCO_ROOT     dataset root holding annotations/, train2017/, val2017/
DEVICE        torch device string
"""
import os
from pathlib import Path

REPO = Path(__file__).resolve().parent.parent

UPSTREAM_BACKBONE = 'facebook/EUPE-ViT-B'
BACKBONE = os.environ.get('BACKBONE') or os.environ.get('ARGUS_PATH') or 'phanerozoic/argus'
BACKBONE_SRC = os.environ.get('BACKBONE_SRC') or os.environ.get('ARGUS_SRC') or None
COCO_ROOT = Path(os.environ.get('COCO_ROOT', '/home/zootest/datasets/coco'))

ARGUS = BACKBONE


def device() -> str:
    if 'DEVICE' in os.environ:
        return os.environ['DEVICE']
    import torch
    return 'cuda' if torch.cuda.is_available() else 'cpu'