This commit is contained in:
Glenn Jocher 2019-04-24 21:37:32 +02:00
parent fa0acebe2a
commit 3e71b8d48b
2 changed files with 5 additions and 4 deletions

View File

@ -144,14 +144,15 @@ class LoadImagesAndLabels(Dataset): # for training/testing
for x in self.img_files] for x in self.img_files]
# Rectangular Training https://github.com/ultralytics/yolov3/issues/232 # Rectangular Training https://github.com/ultralytics/yolov3/issues/232
self.train_rectangular = False self.train_rectangular = True
if self.train_rectangular: if self.train_rectangular:
bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index bi = np.floor(np.arange(n) / batch_size).astype(np.int) # batch index
nb = bi[-1] # number of batches nb = bi[-1] + 1 # number of batches
from PIL import Image from PIL import Image
# Read image aspect ratios # Read image aspect ratios
s = np.array([Image.open(f).size for f in tqdm(self.img_files, desc='Reading image shapes')]) iter = tqdm(self.img_files, desc='Reading image shapes') if n > 100 else self.img_files
s = np.array([Image.open(f).size for f in iter])
ar = s[:, 1] / s[:, 0] # aspect ratio ar = s[:, 1] / s[:, 0] # aspect ratio
# Sort by aspect ratio # Sort by aspect ratio

View File

@ -64,7 +64,7 @@ sudo shutdown
rm -rf yolov3 rm -rf yolov3
git clone https://github.com/ultralytics/yolov3 # master git clone https://github.com/ultralytics/yolov3 # master
cp -r cocoapi/PythonAPI/pycocotools yolov3 cp -r cocoapi/PythonAPI/pycocotools yolov3
cp -r weights yolov3 && cd yolov3 cp -r weights yolov3 && cd yolov3
python3 detect.py # detect python3 detect.py # detect
python3 test.py --data data/coco_32img.data # test python3 test.py --data data/coco_32img.data # test
python3 train.py --data data/coco_32img.data --epochs 4 --nosave # train python3 train.py --data data/coco_32img.data --epochs 4 --nosave # train