Skip to content
This repository was archived by the owner on Mar 24, 2021. It is now read-only.

Commit 7547f14

Browse files
committed
update README - image size #17
1 parent e890588 commit 7547f14

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ For more model and configuration please see [YOLO website](http://pjreddie.com/
4545
--path_weights ./model_data/yolo.h5 \
4646
--path_anchors ./model_data/yolo_anchors.csv \
4747
--path_classes ./model_data/coco_classes.txt \
48+
--model_image_size 608 608 \
4849
--path_output ./results \
4950
--path_image ./model_data/bike-car-dog.jpg \
5051
--path_video person.mp4
5152
```
5253
For Full YOLOv3, just do in a similar way, just specify model path and anchor path with `--path_weights <model_file>` and `--path_anchors <anchor_file>`.
54+
Note `model_image_size` is depending on used model, see width and height in model config `*.cfg`. Expected values are ` 608 608` for full YOLO and and `416 416` for Tiny YOLO.
5355
4. MultiGPU usage: use `--nb_gpu N` to use N GPUs. It is passed to the Keras [multi_gpu_model()](https://keras.io/utils/#multi_gpu_model).
5456

5557
---

scripts/detection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def arg_params_yolo():
4040
help='path to model weight file')
4141
parser.add_argument('-a', '--path_anchors', type=str,
4242
help='path to anchor definitions')
43-
parser.add_argument('--model_image_size', type=int, nargs=2,
44-
help='input image size for the model')
43+
parser.add_argument('--model_image_size', type=int, nargs=2, required=False,
44+
help='input image size for the model', default=(None, None))
4545
parser.add_argument('-c', '--path_classes', type=str,
4646
help='path to class definitions')
4747
parser.add_argument('--nb_gpu', type=int, help='Number of GPU to use',

yolo3/yolo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_defaults(cls, name):
5959
logging.warning('Unrecognized attribute name "%s"', name)
6060
return cls._DEFAULT_PARAMS.get(name)
6161

62-
def __init__(self, weights_path, anchors_path, classes_path, model_image_size,
62+
def __init__(self, weights_path, anchors_path, classes_path, model_image_size=(None, None),
6363
score=0.3, iou=0.45, nb_gpu=1, **kwargs):
6464
"""
6565
@@ -165,7 +165,7 @@ def _generate_class_colors(self):
165165
def detect_image(self, image):
166166
start = time.time()
167167

168-
if self.model_image_size != (None, None):
168+
if isinstance(self.model_image_size, (list, tuple, set)) and all(self.model_image_size):
169169
assert self.model_image_size[0] % 32 == 0, 'Multiples of 32 required'
170170
assert self.model_image_size[1] % 32 == 0, 'Multiples of 32 required'
171171
boxed_image = letterbox_image(image, tuple(reversed(self.model_image_size)))

0 commit comments

Comments
 (0)