forked from meituan/YOLOv6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support rectangle train (meituan#818)
* add rectangle train. * support multi directory image reader.
- Loading branch information
Showing
19 changed files
with
283 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Training size explanation | ||
|
||
YOLOv6 support three training size mode. | ||
|
||
## 1. Square shape training | ||
If you only pass one number to `--img-size`, such as `--img-size 640`, the longer side of image will be keep ratio resized to 640, the shorter side will be scaled with the same ratio, then padded to 640. The image send to the model with resolution (640, 640, 3). | ||
|
||
## 2. Rectangle shape training | ||
If you pass `--img-size 640` and `--rect`, the longer side of image will be keep ratio resized to 640, the shorter side will be scaled with the same ratio, then it will be padded to multiple of 32 (if needed). | ||
For example, if one image's shape is (720, 1280, 3), after keep ratio resize, it's shape will change to (360, 640, 3), however, 320 is not multiple of 32, so it will be padded to (384, 640, 3). | ||
|
||
## 3. Specific shape | ||
|
||
In the rectangle shape mode, the training process may have different traininng size, such as (1080, 1920, 3) and (1200, 1600, 3). If you want to specify one shape, you can use `--specific-shape` command and specify your training shape with `--height ` and `--width`, for example: | ||
``` | ||
python tools/train.py --data data/dataset.yaml --conf configs/yolov6n.py --specific-shape --width 1920 --height 1080 | ||
``` | ||
Then, the resolution of the training data will be (1080, 1920, 3) regardless of the shape of the image in dataset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 训练尺寸说明 | ||
YOLOv6支持三种训练尺寸模式。 | ||
|
||
## 1. 正方形尺寸训练 | ||
如果只给 `--img-size` 指定一个数字,例如 `--img-size 640`,则图像的长边将被缩放到 640(保持长宽比),短边等比例缩放后,将被填充到 640。送入模型的图像的分辨率将变为(640, 640, 3)。 | ||
|
||
## 2. 矩形尺寸训练 | ||
如果传递了 `--img-size 640` 和 `--rect`,则图像的长边将被缩放到 640(保持长宽比),短边将被等比例缩放,然后填充到 32 的倍数(如果需要)。 | ||
例如,如果一张图像的形状为(720, 1280, 3),在等比例缩放后,它的形状将变为(360, 640, 3),但是 360 不是 32 的倍数,因此它将被填充为(384, 640, 3)。 | ||
|
||
## 3. 特定尺寸 | ||
在矩形尺寸训练模式下,训练过程可能有不同的训练尺寸,例如(1080, 1920, 3)和(1200, 1600, 3)。如果您想指定一个尺寸,可以使用 `--specific-shape` 命令,并使用 `--height` 和 `--width` 指定您的训练尺寸,例如: | ||
``` | ||
python tools/train.py --data data/dataset.yaml --conf configs/yolov6n.py --specific-shape --width 1920 --height 1080 | ||
``` | ||
那么,无论数据集中图片的形状是什么,训练数据的分辨率将都是 (1080, 1920, 3)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.