Skip to content

Commit

Permalink
fix(plugins): update workflow and fix bug of kwargs in nano (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
FateScript committed Oct 29, 2021
1 parent 6880e39 commit 38c633b
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/format_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ set -e

export PYTHONPATH=$PWD:$PYTHONPATH

flake8 yolox || flake8_ret=$?
flake8 yolox exps tools || flake8_ret=$?
if [ "$flake8_ret" ]; then
exit $flake8_ret
fi
echo "All flake check passed!"
isort --check-only -rc yolox || isort_ret=$?
isort --check-only -rc yolox exps || isort_ret=$?
if [ "$isort_ret" ]; then
exit $isort_ret
fi
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# user experiments directory
YOLOX_outputs/
datasets/
# do not ignore datasets under yolox/data
!*yolox/data/datasets/

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
Expand Down
10 changes: 8 additions & 2 deletions exps/default/nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ def init_yolo(M):
from yolox.models import YOLOX, YOLOPAFPN, YOLOXHead
in_channels = [256, 512, 1024]
# NANO model use depthwise = True, which is main difference.
backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels, self.act, depthwise=True)
head = YOLOXHead(self.num_classes, self.width, in_channels=in_channels, self.act, depthwise=True)
backbone = YOLOPAFPN(
self.depth, self.width, in_channels=in_channels,
act=self.act, depthwise=True,
)
head = YOLOXHead(
self.num_classes, self.width, in_channels=in_channels,
act=self.act, depthwise=True
)
self.model = YOLOX(backbone, head)

self.model.apply(init_yolo)
Expand Down
2 changes: 0 additions & 2 deletions exps/default/yolov3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import os

import torch
import torch.nn as nn

from yolox.exp import Exp as MyExp
Expand Down Expand Up @@ -32,4 +31,3 @@ def init_yolo(M):
self.model.head.initialize_biases(1e-2)

return self.model

5 changes: 4 additions & 1 deletion tools/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ def main(exp, args):
trt_file = None
decoder = None

predictor = Predictor(model, exp, COCO_CLASSES, trt_file, decoder, args.device, args.fp16, args.legacy)
predictor = Predictor(
model, exp, COCO_CLASSES, trt_file, decoder,
args.device, args.fp16, args.legacy,
)
current_time = time.localtime()
if args.demo == "image":
image_demo(predictor, vis_folder, args.path, current_time, args.save_result)
Expand Down
2 changes: 1 addition & 1 deletion tools/export_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def main():
from onnxsim import simplify

input_shapes = {args.input: list(dummy_input.shape)} if args.dynamic else None

# use onnxsimplify to reduce reduent model.
onnx_model = onnx.load(args.output_name)
model_simp, check = simplify(onnx_model,
Expand Down
1 change: 0 additions & 1 deletion tools/export_torchscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from loguru import logger

import torch
from torch import nn

from yolox.exp import get_exp

Expand Down
4 changes: 3 additions & 1 deletion tools/trt.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def make_parser():
help="pls input your expriment description file",
)
parser.add_argument("-c", "--ckpt", default=None, type=str, help="ckpt path")
parser.add_argument("-w", '--workspace', type=int, default=32, help='max workspace size in detect')
parser.add_argument(
"-w", '--workspace', type=int, default=32, help='max workspace size in detect'
)
parser.add_argument("-b", '--batch', type=int, default=1, help='max batch size in detect')
return parser

Expand Down

0 comments on commit 38c633b

Please sign in to comment.