glenn-jocher
commited on
Commit
•
f5da528
1
Parent(s):
b35f76e
reformat code
Browse files- .github/workflows/rebase.yml +8 -8
- detect.py +1 -1
- test.py +1 -1
- utils/datasets.py +1 -1
- utils/torch_utils.py +4 -2
.github/workflows/rebase.yml
CHANGED
@@ -11,11 +11,11 @@ jobs:
|
|
11 |
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
12 |
runs-on: ubuntu-latest
|
13 |
steps:
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
11 |
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
12 |
runs-on: ubuntu-latest
|
13 |
steps:
|
14 |
+
- name: Checkout the latest code
|
15 |
+
uses: actions/checkout@v2
|
16 |
+
with:
|
17 |
+
fetch-depth: 0
|
18 |
+
- name: Automatic Rebase
|
19 |
+
uses: cirrus-actions/rebase@1.3.1
|
20 |
+
env:
|
21 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
detect.py
CHANGED
@@ -13,7 +13,7 @@ from numpy import random
|
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.datasets import LoadStreams, LoadImages
|
15 |
from utils.general import (
|
16 |
-
check_img_size, non_max_suppression, apply_classifier, scale_coords,
|
17 |
xyxy2xywh, plot_one_box, strip_optimizer, set_logging)
|
18 |
from utils.torch_utils import select_device, load_classifier, time_synchronized
|
19 |
|
|
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.datasets import LoadStreams, LoadImages
|
15 |
from utils.general import (
|
16 |
+
check_img_size, non_max_suppression, apply_classifier, scale_coords,
|
17 |
xyxy2xywh, plot_one_box, strip_optimizer, set_logging)
|
18 |
from utils.torch_utils import select_device, load_classifier, time_synchronized
|
19 |
|
test.py
CHANGED
@@ -13,7 +13,7 @@ from tqdm import tqdm
|
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.datasets import create_dataloader
|
15 |
from utils.general import (
|
16 |
-
coco80_to_coco91_class, check_dataset, check_file, check_img_size, compute_loss, non_max_suppression, scale_coords,
|
17 |
xyxy2xywh, clip_coords, plot_images, xywh2xyxy, box_iou, output_to_target, ap_per_class, set_logging)
|
18 |
from utils.torch_utils import select_device, time_synchronized
|
19 |
|
|
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.datasets import create_dataloader
|
15 |
from utils.general import (
|
16 |
+
coco80_to_coco91_class, check_dataset, check_file, check_img_size, compute_loss, non_max_suppression, scale_coords,
|
17 |
xyxy2xywh, clip_coords, plot_images, xywh2xyxy, box_iou, output_to_target, ap_per_class, set_logging)
|
18 |
from utils.torch_utils import select_device, time_synchronized
|
19 |
|
utils/datasets.py
CHANGED
@@ -423,7 +423,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|
423 |
ne += 1 # print('empty labels for image %s' % self.img_files[i]) # file empty
|
424 |
# os.system("rm '%s' '%s'" % (self.img_files[i], self.label_files[i])) # remove
|
425 |
|
426 |
-
if rank in [-1,0]:
|
427 |
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
428 |
cache_path, nf, nm, ne, nd, n)
|
429 |
if nf == 0:
|
|
|
423 |
ne += 1 # print('empty labels for image %s' % self.img_files[i]) # file empty
|
424 |
# os.system("rm '%s' '%s'" % (self.img_files[i], self.label_files[i])) # remove
|
425 |
|
426 |
+
if rank in [-1, 0]:
|
427 |
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
428 |
cache_path, nf, nm, ne, nd, n)
|
429 |
if nf == 0:
|
utils/torch_utils.py
CHANGED
@@ -12,6 +12,7 @@ import torchvision.models as models
|
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
|
|
15 |
def init_seeds(seed=0):
|
16 |
torch.manual_seed(seed)
|
17 |
|
@@ -43,7 +44,7 @@ def select_device(device='', batch_size=None):
|
|
43 |
if i == 1:
|
44 |
s = ' ' * len(s)
|
45 |
logger.info("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
46 |
-
|
47 |
else:
|
48 |
logger.info('Using CPU')
|
49 |
|
@@ -144,7 +145,8 @@ def model_info(model, verbose=False):
|
|
144 |
except:
|
145 |
fs = ''
|
146 |
|
147 |
-
logger.info(
|
|
|
148 |
|
149 |
|
150 |
def load_classifier(name='resnet101', n=2):
|
|
|
12 |
|
13 |
logger = logging.getLogger(__name__)
|
14 |
|
15 |
+
|
16 |
def init_seeds(seed=0):
|
17 |
torch.manual_seed(seed)
|
18 |
|
|
|
44 |
if i == 1:
|
45 |
s = ' ' * len(s)
|
46 |
logger.info("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
47 |
+
(s, i, x[i].name, x[i].total_memory / c))
|
48 |
else:
|
49 |
logger.info('Using CPU')
|
50 |
|
|
|
145 |
except:
|
146 |
fs = ''
|
147 |
|
148 |
+
logger.info(
|
149 |
+
'Model Summary: %g layers, %g parameters, %g gradients%s' % (len(list(model.parameters())), n_p, n_g, fs))
|
150 |
|
151 |
|
152 |
def load_classifier(name='resnet101', n=2):
|