Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove calling function self inside function definition #345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions data/coco128.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# COCO 2017 dataset http://cocodataset.org - first 128 training images
# Train command: python train.py --data coco128.yaml
# Default dataset location is next to YOLOv5:
# /parent
# /datasets/coco128
# /yolov5


# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
# path: ../datasets/coco128 # dataset root dir
train: ../datasets/coco128/images/train2017 # train images 128 images
val: ../datasets/coco128/images/train2017 # val images 128 images
test: # test images (optional)

# Classes
nc: 80 # number of classes
names: [ 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard',
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple',
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone',
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear',
'hair drier', 'toothbrush' ] # class names


# Download script/URL (optional)
download: https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip
3 changes: 3 additions & 0 deletions run_inference.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# !/bin/bash
python test.py --device 0 --batch-size 16 --img 640 --data data/coco128.yaml --cfg cfg/yolov4-pacsp.cfg --weights 'weights/yolov4_pacsp.pt'

3 changes: 3 additions & 0 deletions run_training.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# !/bin/bash
python train.py --device 0 --batch-size 16 --img 640 640 --data data/coco128.yaml --cfg cfg/yolov4-pacsp.cfg --weights 'weights/yolov4_pacsp.pt' --name yolov4-pacsp --epochs 100

5 changes: 3 additions & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def train(hyp, opt, device, tb_writer=None):
init_seeds(2 + rank)
with open(opt.data) as f:
data_dict = yaml.load(f, Loader=yaml.FullLoader) # model dict
# data_dict = yaml.safe_load(f) # model dict
train_path = data_dict['train']
test_path = data_dict['val']
nc, names = (1, ['item']) if opt.single_cls else (int(data_dict['nc']), data_dict['names']) # number classes, names
Expand Down Expand Up @@ -400,8 +401,8 @@ def train(hyp, opt, device, tb_writer=None):
if last and not opt.weights:
print(f'Resuming training from {last}')
opt.weights = last if opt.resume and not opt.weights else opt.weights
if opt.local_rank == -1 or ("RANK" in os.environ and os.environ["RANK"] == "0"):
check_git_status()
# if opt.local_rank == -1 or ("RANK" in os.environ and os.environ["RANK"] == "0"):
# check_git_status()

opt.hyp = opt.hyp or ('data/hyp.scratch.yaml')
opt.data, opt.cfg, opt.hyp = check_file(opt.data), check_file(opt.cfg), check_file(opt.hyp) # check files
Expand Down
1 change: 0 additions & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def torch_distributed_zero_first(local_rank: int):
def init_seeds(seed=0):
random.seed(seed)
np.random.seed(seed)
init_seeds(seed=seed)


def get_latest_run(search_dir='./runs'):
Expand Down