Skip to content

Commit

Permalink
这里是调通的可以训练的yolox代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Taoyimeng123 committed Aug 8, 2024
1 parent 1afd8be commit 00125a9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Empty file added abc.txt
Empty file.
6 changes: 5 additions & 1 deletion exps/example/custom/yolox_s.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ def __init__(self):

"""改了"""
# Define yourself dataset path
# self.data_dir = "/workspace/dataset/coco/aaa/"
self.data_dir = "/workspace/dataset/coco/"
self.train_ann = "instances_train2017.json"
self.val_ann = "instances_val2017.json"
# self.data_dir = "datasets/coco128"
# self.train_ann = "instances_train2017.json"
# self.val_ann = "instances_val2017.json"
self.eval_interval = 1000
"""改了"""

self.num_classes = 71
self.num_classes =71



self.max_epoch = 300
self.data_num_workers = 4
Expand Down
15 changes: 14 additions & 1 deletion tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
from yolox.utils import configure_module, configure_nccl, configure_omp, get_num_devices


# def test_parser():
# parser = argparse.ArgumentParser("YOLOX test parser")
# parser.add_argument(
# "-n", "--name", type=int, default=5, help="model name"
# )
# return parser

def make_parser():
parser = argparse.ArgumentParser("YOLOX train parser")
parser.add_argument("-expn", "--experiment-name", type=str, default=None)
Expand All @@ -36,7 +43,7 @@ def make_parser():
type=str,
help="url used to set up distributed training",
)
parser.add_argument("-b", "--batch-size", type=int, default=64, help="batch size")

parser.add_argument(
"-d", "--devices", default=None, type=int, help="device for training"
)
Expand All @@ -48,6 +55,7 @@ def make_parser():
type=str,
help="plz input your experiment description file",
)
parser.add_argument("-b", "--batch-size", type=int, default=16, help="batch size")
parser.add_argument(
"--resume", default=False, action="store_true", help="resume training"
)
Expand Down Expand Up @@ -95,6 +103,7 @@ def make_parser():
Implemented loggers include `tensorboard`, `mlflow` and `wandb`.",
default="tensorboard"
)

parser.add_argument(
"opts",
help="Modify config options using the command-line",
Expand Down Expand Up @@ -126,8 +135,12 @@ def main(exp: Exp, args):


if __name__ == "__main__":
# aaa = test_parser().parse_args()
# print(aaa.name)
configure_module()
args = make_parser().parse_args()
# make_parser().parse_args().batch_size
# print(args.batch_size)
exp = get_exp(args.exp_file, args.name)
exp.merge(args.opts)
check_exp_value(exp)
Expand Down
3 changes: 2 additions & 1 deletion yolox/data/datasets/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def __init__(
# if data_dir is None:
# data_dir = os.path.join(get_yolox_datadir(), "COCO")
# 改了
data_dir = "/workspace/dataset/coco/" #改了
# data_dir = "/workspace/dataset/coco/" #改了
# data_dir = "/workspace/dataset/" #改了
self.data_dir = data_dir
self.json_file = json_file

Expand Down

0 comments on commit 00125a9

Please sign in to comment.