mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
reformat code
This commit is contained in:
parent
b35f76e3d0
commit
f5da528d28
16
.github/workflows/rebase.yml
vendored
16
.github/workflows/rebase.yml
vendored
@ -11,11 +11,11 @@ jobs:
|
|||||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the latest code
|
- name: Checkout the latest code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Automatic Rebase
|
- name: Automatic Rebase
|
||||||
uses: cirrus-actions/rebase@1.3.1
|
uses: cirrus-actions/rebase@1.3.1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -13,7 +13,7 @@ from numpy import random
|
|||||||
from models.experimental import attempt_load
|
from models.experimental import attempt_load
|
||||||
from utils.datasets import LoadStreams, LoadImages
|
from utils.datasets import LoadStreams, LoadImages
|
||||||
from utils.general import (
|
from utils.general import (
|
||||||
check_img_size, non_max_suppression, apply_classifier, scale_coords,
|
check_img_size, non_max_suppression, apply_classifier, scale_coords,
|
||||||
xyxy2xywh, plot_one_box, strip_optimizer, set_logging)
|
xyxy2xywh, plot_one_box, strip_optimizer, set_logging)
|
||||||
from utils.torch_utils import select_device, load_classifier, time_synchronized
|
from utils.torch_utils import select_device, load_classifier, time_synchronized
|
||||||
|
|
||||||
|
2
test.py
2
test.py
@ -13,7 +13,7 @@ from tqdm import tqdm
|
|||||||
from models.experimental import attempt_load
|
from models.experimental import attempt_load
|
||||||
from utils.datasets import create_dataloader
|
from utils.datasets import create_dataloader
|
||||||
from utils.general import (
|
from utils.general import (
|
||||||
coco80_to_coco91_class, check_dataset, check_file, check_img_size, compute_loss, non_max_suppression, scale_coords,
|
coco80_to_coco91_class, check_dataset, check_file, check_img_size, compute_loss, non_max_suppression, scale_coords,
|
||||||
xyxy2xywh, clip_coords, plot_images, xywh2xyxy, box_iou, output_to_target, ap_per_class, set_logging)
|
xyxy2xywh, clip_coords, plot_images, xywh2xyxy, box_iou, output_to_target, ap_per_class, set_logging)
|
||||||
from utils.torch_utils import select_device, time_synchronized
|
from utils.torch_utils import select_device, time_synchronized
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|||||||
ne += 1 # print('empty labels for image %s' % self.img_files[i]) # file empty
|
ne += 1 # print('empty labels for image %s' % self.img_files[i]) # file empty
|
||||||
# os.system("rm '%s' '%s'" % (self.img_files[i], self.label_files[i])) # remove
|
# os.system("rm '%s' '%s'" % (self.img_files[i], self.label_files[i])) # remove
|
||||||
|
|
||||||
if rank in [-1,0]:
|
if rank in [-1, 0]:
|
||||||
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
pbar.desc = 'Scanning labels %s (%g found, %g missing, %g empty, %g duplicate, for %g images)' % (
|
||||||
cache_path, nf, nm, ne, nd, n)
|
cache_path, nf, nm, ne, nd, n)
|
||||||
if nf == 0:
|
if nf == 0:
|
||||||
|
@ -12,6 +12,7 @@ import torchvision.models as models
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def init_seeds(seed=0):
|
def init_seeds(seed=0):
|
||||||
torch.manual_seed(seed)
|
torch.manual_seed(seed)
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ def select_device(device='', batch_size=None):
|
|||||||
if i == 1:
|
if i == 1:
|
||||||
s = ' ' * len(s)
|
s = ' ' * len(s)
|
||||||
logger.info("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
logger.info("%sdevice%g _CudaDeviceProperties(name='%s', total_memory=%dMB)" %
|
||||||
(s, i, x[i].name, x[i].total_memory / c))
|
(s, i, x[i].name, x[i].total_memory / c))
|
||||||
else:
|
else:
|
||||||
logger.info('Using CPU')
|
logger.info('Using CPU')
|
||||||
|
|
||||||
@ -144,7 +145,8 @@ def model_info(model, verbose=False):
|
|||||||
except:
|
except:
|
||||||
fs = ''
|
fs = ''
|
||||||
|
|
||||||
logger.info('Model Summary: %g layers, %g parameters, %g gradients%s' % (len(list(model.parameters())), n_p, n_g, fs))
|
logger.info(
|
||||||
|
'Model Summary: %g layers, %g parameters, %g gradients%s' % (len(list(model.parameters())), n_p, n_g, fs))
|
||||||
|
|
||||||
|
|
||||||
def load_classifier(name='resnet101', n=2):
|
def load_classifier(name='resnet101', n=2):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user