Skip to content

Commit

Permalink
misc: add ci pr stages tests, update notebooks
Browse files Browse the repository at this point in the history
misc: add ci pr stages tests, update notebooks
  • Loading branch information
Unbinilium authored Jul 7, 2023
2 parents 5f458ab + a74fe8c commit 3250c4c
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 39 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/code-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: code-lint
on:
push:
branches:
- dev # should be 'main' later
- main
paths:
- 'configs/**'
- 'edgelab/**'
Expand All @@ -14,7 +14,14 @@ on:

pull_request:
branches:
- dev # should be 'main' later
- dev
paths:
- 'configs/**'
- 'edgelab/**'
- 'tools/**'
- 'pyproject.toml'
- '.pre-commit-config.yaml'
- '.github/workflows/code-lint.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: 'main' # should be main later

- name: setup node
uses: actions/setup-node@v3
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: functional-test
on:
push:
branches:
- dev # should be 'main' later
- main
paths:
- 'configs/**'
- 'edgelab/**'
Expand All @@ -17,6 +17,27 @@ on:
- 'setup.py'
- '.github/workflows/functional-test.yml'

pull_request:
branches:
- dev
paths:
- 'configs/**'
- 'edgelab/**'
- 'requirements/**'
- 'scripts/**'
- 'tools/**'
- 'environment.yml'
- 'environment_cuda.yml'
- 'requirements.txt'
- 'requirements_cuda.txt'
- 'setup.py'
- '.github/workflows/functional-test.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
partial-test:
name: functional test for (${{ matrix.task }}, ${{ matrix.os }})
Expand All @@ -37,8 +58,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: dev # should be main later

- name: setup python
uses: actions/setup-python@v4
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: smoke-test
on:
push:
branches:
- dev # should be 'main' later
- dev
- main
paths:
- 'requirements/**'
- 'scripts/**'
Expand All @@ -17,6 +18,10 @@ on:
schedule:
- cron: '0 0 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
manual-installation:
name: manual installation test for (${{ matrix.python-version }}, ${{ matrix.os }})
Expand All @@ -39,8 +44,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: dev # should be main later

- name: setup python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -73,8 +76,6 @@ jobs:
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: dev # should be main later

- name: setup deps
run: |
Expand Down
6 changes: 3 additions & 3 deletions configs/yolov5/base_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# -----train val related-----
# Base learning rate for optim_wrapper. Corresponding to 8xb16=128 bs
base_lr = 0.01
max_epochs = 300 # Maximum training epochs
epochs = 300 # Maximum training epochs

model_test_cfg = dict(
# The config of multi-label for multi-class prediction.
Expand Down Expand Up @@ -239,7 +239,7 @@

default_hooks = dict(
param_scheduler=dict(
type='YOLOv5ParamSchedulerHook', scheduler_type='linear', lr_factor=lr_factor, max_epochs=max_epochs
type='YOLOv5ParamSchedulerHook', scheduler_type='linear', lr_factor=lr_factor, max_epochs=epochs
),
checkpoint=dict(
type='CheckpointHook', interval=save_checkpoint_intervals, save_best='auto', max_keep_ckpts=max_keep_ckpts
Expand All @@ -258,7 +258,7 @@
test_evaluator = val_evaluator

train_cfg = dict(
type='EpochBasedTrainLoop', max_epochs=max_epochs, val_interval=save_checkpoint_intervals, _delete_=True
type='EpochBasedTrainLoop', max_epochs=epochs, val_interval=save_checkpoint_intervals, _delete_=True
)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
6 changes: 3 additions & 3 deletions configs/yolox/base_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# -----train val related-----
# Base learning rate for optim_wrapper. Corresponding to 8xb16=128 bs
base_lr = 0.01
max_epochs = 300 # Maximum training epochs
epochs = 300 # Maximum training epochs

model_test_cfg = dict(
# The config of multi-label for multi-class prediction.
Expand Down Expand Up @@ -292,7 +292,7 @@
type="YOLOv5ParamSchedulerHook",
scheduler_type="linear",
lr_factor=lr_factor,
max_epochs=max_epochs,
max_epochs=epochs,
),
checkpoint=dict(
type="CheckpointHook",
Expand Down Expand Up @@ -323,7 +323,7 @@

train_cfg = dict(
type="EpochBasedTrainLoop",
max_epochs=max_epochs,
max_epochs=epochs,
val_interval=save_checkpoint_intervals,
_delete_=True,
)
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/training/fomo.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ optim_wrapper=dict(optimizer=dict(type='Adam', lr=lr, weight_decay=5e-4,eps=1e-7
#evaluator
val_evaluator=dict(type='FomoMetric')
test_evaluator=val_evaluator
train_cfg=dict(by_epoch=True,max_epochs=70)
train_cfg=dict(by_epoch=True, max_epochs=70)

# learning policy
param_scheduler=[
Expand Down
14 changes: 6 additions & 8 deletions notebooks/Google-Colab-PFLD-Grove-Example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,12 @@
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/train.py \\\n",
" pose \\\n",
" configs/pfld/pfld_mbv2n_112.py \\\n",
" --cfg-options \\\n",
" epochs=50 \\\n",
" num_classes=1 \\\n",
" data_root='datasets/meter' \\\n",
" load_from=pre-train/pfld_mv2n_112.pth "
" load_from='pre-train/pfld_mv2n_112.pth'"
]
},
{
Expand Down Expand Up @@ -362,8 +361,7 @@
},
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/test.py \\\n",
" pose \\\n",
"!${PYTHON_EXEC} tools/inference.py \\\n",
" configs/pfld/pfld_mbv2n_112.py \\\n",
" \"$(cat work_dirs/pfld_mbv2n_112/last_checkpoint)\" \\\n",
" --dump work_dirs/pfld_mbv2n_112/last_checkpoint.pkl \\\n",
Expand Down Expand Up @@ -425,10 +423,10 @@
},
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/torch2tflite.py \\\n",
"!${PYTHON_EXEC} tools/export.py \\\n",
" configs/pfld/pfld_mbv2n_112.py \\\n",
" --checkpoint $(cat work_dirs/pfld_mbv2n_112/last_checkpoint) \\\n",
" --type int8 \\\n",
" $(cat work_dirs/pfld_mbv2n_112/last_checkpoint) \\\n",
" tflite \\\n",
" --cfg-options \\\n",
" data_root='datasets/meter'"
]
Expand Down Expand Up @@ -650,7 +648,7 @@
"!cd example/grove && \\\n",
" ${PYTHON_EXEC} tools/ufconv/uf2conv.py \\\n",
" -t 1 \\\n",
" -c \"$(cat ../../work_dirs/pfld_mbv2n_112/last_checkpoint)_int8.tflite\" \\\n",
" -c \"$(cat ../../work_dirs/pfld_mbv2n_112/last_checkpoint | sed -e 's/.pth/_int8.tflite/g')\" \\\n",
" -o model.uf2"
]
},
Expand Down
16 changes: 7 additions & 9 deletions notebooks/Google-Colab-YOLOv5-A1101-Example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"\n",
"- `data_root` - the datasets path, which located at path `datasets/digital_meter`\n",
"\n",
"- `max_epochs`- the train epochs, we use `50` to reduce the training time\n",
"- `epochs`- the train epochs, we use `50` to reduce the training time\n",
"\n",
"- `num_classes` - the calsses number of datasets, we use `11` here ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'N']\n",
"\n",
Expand All @@ -220,10 +220,9 @@
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/train.py \\\n",
" det \\\n",
" configs/yolov5/yolov5_tiny_1xb16_300e_coco.py \\\n",
" --cfg-options \\\n",
" max_epochs=50 \\\n",
" epochs=50 \\\n",
" num_classes=11 \\\n",
" data_root='datasets/digital_meter/'"
]
Expand Down Expand Up @@ -290,8 +289,7 @@
},
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/test.py \\\n",
" det \\\n",
"!${PYTHON_EXEC} tools/inference.py \\\n",
" configs/yolov5/yolov5_tiny_1xb16_300e_coco.py \\\n",
" \"$(cat work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint)\" \\\n",
" --dump work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint.pkl \\\n",
Expand Down Expand Up @@ -345,10 +343,10 @@
},
"outputs": [],
"source": [
"!${PYTHON_EXEC} tools/torch2tflite.py \\\n",
"!${PYTHON_EXEC} tools/export.py \\\n",
" configs/yolov5/yolov5_tiny_1xb16_300e_coco.py \\\n",
" --checkpoint $(cat work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint) \\\n",
" --type int8 \\\n",
" $(cat work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint) \\\n",
" tflite \\\n",
" --cfg-options \\\n",
" data_root='datasets/digital_meter/' \\\n",
" num_classes=11"
Expand Down Expand Up @@ -540,7 +538,7 @@
"!cd example/grove && \\\n",
" ${PYTHON_EXEC} tools/ufconv/uf2conv.py \\\n",
" -t 18 \\\n",
" -c \"$(cat ../../work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint)_int8.tflite\" \\\n",
" -c \"$(cat ../../work_dirs/yolov5_tiny_1xb16_300e_coco/last_checkpoint | sed -e 's/.pth/_int8.tflite/g')\" \\\n",
" -o model.uf2"
]
},
Expand Down
6 changes: 3 additions & 3 deletions scripts/test_functional.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ functional_test_core()

CONFIG_FILE_NAME="$(basename -- ${CONFIG_FILE})"
DATASETS_PATH="datasets/$(basename -- ${DATASETS_URL})"
DATASETS_DIR="${DATASETS_PATH%.*}"
DATASETS_DIR="${DATASETS_PATH%.*}/"
LAST_CHECKPOINT="work_dirs/${CONFIG_FILE_NAME%.*}/last_checkpoint"

echo -e "CONFIG_FILE=${CONFIG_FILE}"
Expand All @@ -67,7 +67,7 @@ functional_test_core()
--no-validate \
--cfg-options \
data_root="${DATASETS_DIR}" \
max_epochs=10
epochs=3
return $?
;;
"export")
Expand All @@ -76,7 +76,7 @@ functional_test_core()
"${CONFIG_FILE}" \
"$(cat ${LAST_CHECKPOINT})" \
tflite onnx \
--calibration_epochs 1 \
--calibration-epochs 1 \
--cfg-options \
data_root="${DATASETS_DIR}"
return $?
Expand Down

0 comments on commit 3250c4c

Please sign in to comment.