From ae07be0234fd2b982aab6f6c02780d816a5c7108 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Tue, 9 May 2023 23:59:43 +0800
Subject: [PATCH 01/28] task: create a new project
---
cvmart/readme.md | 2 ++
cvmart/safe_hat_1000xx/config.py | 0
cvmart/safe_hat_1000xx/ji.py | 0
cvmart/safe_hat_1000xx/xxxxx.sh | 0
4 files changed, 2 insertions(+)
create mode 100644 cvmart/readme.md
create mode 100644 cvmart/safe_hat_1000xx/config.py
create mode 100644 cvmart/safe_hat_1000xx/ji.py
create mode 100644 cvmart/safe_hat_1000xx/xxxxx.sh
diff --git a/cvmart/readme.md b/cvmart/readme.md
new file mode 100644
index 00000000..da3ac038
--- /dev/null
+++ b/cvmart/readme.md
@@ -0,0 +1,2 @@
+# cvmart competition baseline
+
diff --git a/cvmart/safe_hat_1000xx/config.py b/cvmart/safe_hat_1000xx/config.py
new file mode 100644
index 00000000..e69de29b
diff --git a/cvmart/safe_hat_1000xx/ji.py b/cvmart/safe_hat_1000xx/ji.py
new file mode 100644
index 00000000..e69de29b
diff --git a/cvmart/safe_hat_1000xx/xxxxx.sh b/cvmart/safe_hat_1000xx/xxxxx.sh
new file mode 100644
index 00000000..e69de29b
From 11dae542efa03c69b184969e7cc6686a97380b95 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Wed, 10 May 2023 00:06:49 +0800
Subject: [PATCH 02/28] docs update readme
---
cvmart/readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index da3ac038..df319c59 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -1,2 +1,3 @@
# cvmart competition baseline
+# the first job
\ No newline at end of file
From e10430eba07cf3c9a4ddbad2091e4aea44cf40cb Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Wed, 10 May 2023 00:20:08 +0800
Subject: [PATCH 03/28] update ji.py
---
cvmart/readme.md | 17 +++++-
cvmart/safe_hat_1000xx/ji.py | 101 +++++++++++++++++++++++++++++++++++
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index df319c59..2ff8ad99 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -1,3 +1,18 @@
# cvmart competition baseline
-# the first job
\ No newline at end of file
+# the first job
+
+
+## fd
+
+
+### dfs
+
+
+
+
+```python
+
+print(123123)
+
+```
\ No newline at end of file
diff --git a/cvmart/safe_hat_1000xx/ji.py b/cvmart/safe_hat_1000xx/ji.py
index e69de29b..83c6a900 100644
--- a/cvmart/safe_hat_1000xx/ji.py
+++ b/cvmart/safe_hat_1000xx/ji.py
@@ -0,0 +1,101 @@
+import json # json模块是Python标准库中的一个模块,用于处理JSON格式的数据。在该代码中,使用json模块将检测结果转换为JSON格式。
+from mmdet.apis import init_detector, inference_detector
+
+import mmcv
+# from mmdet_custom.datasets import D10007Dataset
+
+def init():
+
+ config_file = '/project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py'
+ checkpoint_file = '/project/train/models/train/exp/weights/epoch_320.pth'
+ model = init_detector(config_file, checkpoint_file)
+ # init_detector函数用于初始化MMDetection模型,输入参数包括模型配置文件路径config_file和模型权重文件路径checkpoint_file。该函数返回一个MMDetection模型对象model,用于后续的目标检测操作。
+ return model
+
+def process_image(handle=None, input_image=None, args=None, **kwargs):
+
+ # CLASSES = D10007Dataset.CLASSES # D10007Dataset是一个自定义的数据集类,用于加载数据集的类别信息。在该代码中,通过D10007Dataset.CLASSES获取数据集的类别信息,用于后续的处理。
+ CLASSES = ['person', 'hat', 'head']
+ # CLASSES 是一个 Python列表 例如CLASSES的值为["person", "car", "dog"]
+
+ # result = inference_detector(handle, input_image)
+ # # inference_detector函数用于对输入图像进行目标检测,输入参数包括MMDetection模型对象handle和输入图像input_image。
+ # # 该函数返回一个包含检测结果的列表,其中每个元素表示一个检测框的信息,包括坐标、置信度、类别等。
+
+ # labels = result.pred_instances.labels
+ # objects = []
+ # for i, class_name in enumerate(CLASSES): # 遍历数据集的类别信息CLASSES,对每个类别的检测结果进行处理。
+ # # 具体来说,对于每个类别的检测结果,遍历其中的每个检测框,将检测框的 坐标、置信度、类别 等信息转换为字典格式,并添加到objects列表中。
+
+ # fires = result[i]
+ # for fire in fires: # 具体来说,对于每个类别的检测结果,从result列表中获取该类别的检测结果fires,然后遍历其中的每个检测框fire。
+ # obj = dict(
+ # xmin = int(fire[0].item()),
+ # ymin= int(fire[1].item()),
+ # xmax=int(fire[2].item()),
+ # ymax=int(fire[3].item()),
+ # confidence=fire[4].item(),
+ # name = CLASSES[i]
+ # )
+ # # 对于每个检测框,将其坐标、置信度、类别等信息转换为字典格式,并添加到objects列表中。
+ # # 具体来说,使用dict函数创建一个字典对象obj,其中包含检测框的左上角和右下角坐标、置信度、类别等信息。然后,将obj添加到objects列表中。
+
+ # if obj['confidence' ] >0.5:
+ # objects.append(obj)
+
+ result = inference_detector(handle, input_image)
+ bboxes = result.pred_instances.bboxes
+ scores = result.pred_instances.scores
+ labels = result.pred_instances.labels
+ objects = []
+ fan = len(bboxes)
+ for i in range(len(bboxes)):
+
+ obj = dict(
+ xmin = int(bboxes[i][0]),
+ ymin = int(bboxes[i][1]),
+ xmax = int(bboxes[i][2]),
+ ymax = int(bboxes[i][3]),
+ confidence = float(scores[i]),
+ name = CLASSES[labels[i]])
+ if obj['confidence'] > 0.5:
+ objects.append(obj)
+
+
+
+
+ # model.show_result(img, result)
+ # model.show_result(img, result, out_file='result.jpg', score_thr = 0.3)
+ r_json = dict()
+ r_json['algorithm_data'] = dict(target_info=objects, is_alert=False, target_count=0)
+ r_json['model_data'] = dict(objects=objects)
+
+ '''
+ 这段代码的作用是将MMDetection模型的检测结果转换为字典格式,并添加到objects列表中。具体分析如下:
+
+ objects是一个空列表,用于存储检测结果的信息。
+
+ 在循环体中,使用enumerate函数遍历数据集的类别信息CLASSES,对每个类别的检测结果进行处理。具体来说,对于每个类别的检测结果,从result列表中获取该类别的检测结果fires,然后遍历其中的每个检测框fire。
+
+ 对于每个检测框,将其坐标、置信度、类别等信息转换为字典格式,并添加到objects列表中。具体来说,使用dict函数创建一个字典对象obj,
+ 其中包含检测框的左上角和右下角坐标、置信度、类别等信息。然后,将obj添加到objects列表中。
+
+ 在添加obj到objects列表之前,使用if语句判断检测框的置信度是否大于0.5。如果是,则将obj添加到objects列表中;否则,忽略该检测框。
+
+ 最后,将objects列表转换为字典格式,并添加到r_json字典中。其中,r_json字典包含两个键值对,分别为algorithm_data和model_data。
+ algorithm_data表示算法的输出结果,包括目标信息、是否报警、目标数量等;model_data表示模型的输出结果,包括检测框的信息。
+ '''
+
+ if objects.__len__( ) >0:
+ r_json['algorithm_data']['is_alert'] = True
+ r_json['algorithm_data']['target_count'] = objects.__len__()
+
+ # return json.dumps(objects, indent=4)
+ return json.dumps(r_json, indent=4)
+
+if __name__ == "__main__":
+ handle = init()
+ # 或者 img = mmcv.imread(img), 这将只加载图像一次.
+ img = "/home/data/831/helmet_10809.jpg"
+
+ process_image(handle, img, '{"mask_output_path": "result.png"}')
\ No newline at end of file
From 3c94942f5d9938be478db3ee5ae3c08abebaab71 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Wed, 10 May 2023 02:28:59 +0800
Subject: [PATCH 04/28] update all
---
.../convert_to_coco.py | 152 ++++++
.../ji.py | 0
...rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py | 504 ++++++++++++++++++
cvmart/Helmet_identification_10163/run.sh | 4 +
cvmart/readme.md | 195 ++++++-
cvmart/safe_hat_1000xx/config.py | 0
cvmart/safe_hat_1000xx/xxxxx.sh | 0
7 files changed, 847 insertions(+), 8 deletions(-)
create mode 100644 cvmart/Helmet_identification_10163/convert_to_coco.py
rename cvmart/{safe_hat_1000xx => Helmet_identification_10163}/ji.py (100%)
create mode 100644 cvmart/Helmet_identification_10163/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
create mode 100644 cvmart/Helmet_identification_10163/run.sh
delete mode 100644 cvmart/safe_hat_1000xx/config.py
delete mode 100644 cvmart/safe_hat_1000xx/xxxxx.sh
diff --git a/cvmart/Helmet_identification_10163/convert_to_coco.py b/cvmart/Helmet_identification_10163/convert_to_coco.py
new file mode 100644
index 00000000..6dd832fe
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/convert_to_coco.py
@@ -0,0 +1,152 @@
+# coding:utf-8
+
+# pip install lxml
+
+import os
+import glob
+import json
+import shutil
+import numpy as np
+import xml.etree.ElementTree as ET
+
+path2 = "."
+
+START_BOUNDING_BOX_ID = 1
+
+
+def get(root, name):
+ return root.findall(name)
+
+
+def get_and_check(root, name, length):
+ vars = root.findall(name)
+ if len(vars) == 0:
+ raise NotImplementedError('Can not find %s in %s.' % (name, root.tag))
+ if length > 0 and len(vars) != length:
+ raise NotImplementedError('The size of %s is supposed to be %d, but is %d.' % (name, length, len(vars)))
+ if length == 1:
+ vars = vars[0]
+ return vars
+
+
+def convert(xml_list, json_file):
+ json_dict = {"images": [], "type": "instances", "annotations": [], "categories": []}
+ categories = pre_define_categories.copy()
+ bnd_id = START_BOUNDING_BOX_ID
+ all_categories = {}
+ for index, line in enumerate(xml_list):
+ # print("Processing %s"%(line))
+ xml_f = line
+ tree = ET.parse(xml_f)
+ root = tree.getroot()
+
+ filename = os.path.basename(xml_f)[:-4] + ".jpg"
+ image_id = 20190000001 + index
+ size = get_and_check(root, 'size', 1)
+ width = int(get_and_check(size, 'width', 1).text)
+ height = int(get_and_check(size, 'height', 1).text)
+ image = {'file_name': filename, 'height': height, 'width': width, 'id': image_id}
+ json_dict['images'].append(image)
+ ## Cruuently we do not support segmentation
+ # segmented = get_and_check(root, 'segmented', 1).text
+ # assert segmented == '0'
+ for obj in get(root, 'object'):
+ category = get_and_check(obj, 'name', 1).text
+ if category in all_categories:
+ all_categories[category] += 1
+ else:
+ all_categories[category] = 1
+ if category not in categories:
+ if only_care_pre_define_categories:
+ continue
+ new_id = len(categories) + 1
+ print(
+ "[warning] category '{}' not in 'pre_define_categories'({}), create new id: {} automatically".format(
+ category, pre_define_categories, new_id))
+ categories[category] = new_id
+ category_id = categories[category]
+ bndbox = get_and_check(obj, 'bndbox', 1)
+ xmin = int(float(get_and_check(bndbox, 'xmin', 1).text))
+ ymin = int(float(get_and_check(bndbox, 'ymin', 1).text))
+ xmax = int(float(get_and_check(bndbox, 'xmax', 1).text))
+ ymax = int(float(get_and_check(bndbox, 'ymax', 1).text))
+ assert (xmax > xmin), "xmax <= xmin, {}".format(line)
+ assert (ymax > ymin), "ymax <= ymin, {}".format(line)
+ o_width = abs(xmax - xmin)
+ o_height = abs(ymax - ymin)
+ ann = {'area': o_width * o_height, 'iscrowd': 0, 'image_id':
+ image_id, 'bbox': [xmin, ymin, o_width, o_height],
+ 'category_id': category_id, 'id': bnd_id, 'ignore': 0,
+ 'segmentation': []}
+ json_dict['annotations'].append(ann)
+ bnd_id = bnd_id + 1
+
+ for cate, cid in categories.items():
+ cat = {'supercategory': 'none', 'id': cid, 'name': cate}
+ json_dict['categories'].append(cat)
+ json_fp = open(json_file, 'w')
+ json_str = json.dumps(json_dict)
+ json_fp.write(json_str)
+ json_fp.close()
+ print("------------create {} done--------------".format(json_file))
+ print("find {} categories: {} -->>> your pre_define_categories {}: {}".format(len(all_categories),
+ all_categories.keys(),
+ len(pre_define_categories),
+ pre_define_categories.keys()))
+ print("category: id --> {}".format(categories))
+ print(categories.keys())
+ print(categories.values())
+
+
+if __name__ == '__main__':
+ classes = ['person', 'head', 'hat']
+ pre_define_categories = {}
+ for i, cls in enumerate(classes):
+ pre_define_categories[cls] = i + 1
+ # pre_define_categories = {'a1': 1, 'a3': 2, 'a6': 3, 'a9': 4, "a10": 5}
+ only_care_pre_define_categories = True
+ # only_care_pre_define_categories = False
+
+ train_ratio = 0.9
+ save_json_train = '/project/train/src_repo/coco_annotations/instances_train2014.json'
+ save_json_val = 'instances_val2014.json'
+ xml_dir = "/home/data/831/"
+
+ xml_list = glob.glob(xml_dir + "/*.xml")
+ xml_list = np.sort(xml_list)
+ np.random.seed(100)
+ np.random.shuffle(xml_list)
+
+ train_num = int(len(xml_list) * train_ratio)
+ xml_list_train = xml_list[:train_num]
+ xml_list_val = xml_list[train_num:]
+
+ convert(xml_list_train, save_json_train)
+ convert(xml_list_val, save_json_val)
+
+ if os.path.exists(path2 + "/annotations"):
+ shutil.rmtree(path2 + "/annotations")
+ os.makedirs(path2 + "/annotations")
+ if os.path.exists(path2 + "/images/train2014"):
+ shutil.rmtree(path2 + "/images/train2014")
+ os.makedirs(path2 + "/images/train2014")
+ if os.path.exists(path2 + "/images/val2014"):
+ shutil.rmtree(path2 + "/images/val2014")
+ os.makedirs(path2 + "/images/val2014")
+
+ f1 = open("train.txt", "w")
+ for xml in xml_list_train:
+ img = xml[:-4] + ".jpg"
+ f1.write(os.path.basename(xml)[:-4] + "\n")
+ shutil.copyfile(img, path2 + "/images/train2014/" + os.path.basename(img))
+
+ f2 = open("test.txt", "w")
+ for xml in xml_list_val:
+ img = xml[:-4] + ".jpg"
+ f2.write(os.path.basename(xml)[:-4] + "\n")
+ shutil.copyfile(img, path2 + "/images/val2014/" + os.path.basename(img))
+ f1.close()
+ f2.close()
+ print("-------------------------------")
+ print("train number:", len(xml_list_train))
+ print("val number:", len(xml_list_val))
\ No newline at end of file
diff --git a/cvmart/safe_hat_1000xx/ji.py b/cvmart/Helmet_identification_10163/ji.py
similarity index 100%
rename from cvmart/safe_hat_1000xx/ji.py
rename to cvmart/Helmet_identification_10163/ji.py
diff --git a/cvmart/Helmet_identification_10163/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py b/cvmart/Helmet_identification_10163/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
new file mode 100644
index 00000000..f2ed3a6b
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
@@ -0,0 +1,504 @@
+default_scope = 'mmyolo'
+default_hooks = dict(
+ timer=dict(type='IterTimerHook'),
+ logger=dict(type='LoggerHook', interval=50),
+ param_scheduler=dict(type='ParamSchedulerHook'),
+ checkpoint=dict(type='CheckpointHook', interval=10, max_keep_ckpts=3),
+ sampler_seed=dict(type='DistSamplerSeedHook'),
+ visualization=dict(type='mmdet.DetVisualizationHook'))
+env_cfg = dict(
+ cudnn_benchmark=True,
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
+ dist_cfg=dict(backend='nccl'))
+vis_backends = [dict(type='LocalVisBackend')]
+visualizer = dict(
+ type='mmdet.DetLocalVisualizer',
+ vis_backends=[dict(type='LocalVisBackend')],
+ name='visualizer')
+log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
+log_level = 'INFO'
+load_from = None
+resume = False
+file_client_args = dict(backend='disk')
+_file_client_args = dict(backend='disk')
+tta_model = dict(
+ type='mmdet.DetTTAModel',
+ tta_cfg=dict(nms=dict(type='nms', iou_threshold=0.65), max_per_img=300))
+img_scales = [(640, 640), (320, 320), (960, 960)]
+_multiscale_resize_transforms = [
+ dict(
+ type='Compose',
+ transforms=[
+ dict(type='YOLOv5KeepRatioResize', scale=(640, 640)),
+ dict(
+ type='LetterResize',
+ scale=(640, 640),
+ allow_scale_up=False,
+ pad_val=dict(img=114))
+ ]),
+ dict(
+ type='Compose',
+ transforms=[
+ dict(type='YOLOv5KeepRatioResize', scale=(320, 320)),
+ dict(
+ type='LetterResize',
+ scale=(320, 320),
+ allow_scale_up=False,
+ pad_val=dict(img=114))
+ ]),
+ dict(
+ type='Compose',
+ transforms=[
+ dict(type='YOLOv5KeepRatioResize', scale=(960, 960)),
+ dict(
+ type='LetterResize',
+ scale=(960, 960),
+ allow_scale_up=False,
+ pad_val=dict(img=114))
+ ])
+]
+tta_pipeline = [
+ dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
+ dict(
+ type='TestTimeAug',
+ transforms=[[{
+ 'type':
+ 'Compose',
+ 'transforms': [{
+ 'type': 'YOLOv5KeepRatioResize',
+ 'scale': (640, 640)
+ }, {
+ 'type': 'LetterResize',
+ 'scale': (640, 640),
+ 'allow_scale_up': False,
+ 'pad_val': {
+ 'img': 114
+ }
+ }]
+ }, {
+ 'type':
+ 'Compose',
+ 'transforms': [{
+ 'type': 'YOLOv5KeepRatioResize',
+ 'scale': (320, 320)
+ }, {
+ 'type': 'LetterResize',
+ 'scale': (320, 320),
+ 'allow_scale_up': False,
+ 'pad_val': {
+ 'img': 114
+ }
+ }]
+ }, {
+ 'type':
+ 'Compose',
+ 'transforms': [{
+ 'type': 'YOLOv5KeepRatioResize',
+ 'scale': (960, 960)
+ }, {
+ 'type': 'LetterResize',
+ 'scale': (960, 960),
+ 'allow_scale_up': False,
+ 'pad_val': {
+ 'img': 114
+ }
+ }]
+ }],
+ [{
+ 'type': 'mmdet.RandomFlip',
+ 'prob': 1.0
+ }, {
+ 'type': 'mmdet.RandomFlip',
+ 'prob': 0.0
+ }], [{
+ 'type': 'mmdet.LoadAnnotations',
+ 'with_bbox': True
+ }],
+ [{
+ 'type':
+ 'mmdet.PackDetInputs',
+ 'meta_keys':
+ ('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor', 'pad_param', 'flip', 'flip_direction')
+ }]])
+]
+data_root = 'data/coco/'
+train_ann_file = 'annotations/instances_train2017.json'
+train_data_prefix = 'train2017/'
+val_ann_file = 'annotations/instances_val2017.json'
+val_data_prefix = 'val2017/'
+
+class_name = ('person', 'head', 'hat')
+metainfo = dict(
+classes=class_name,
+palette=[(255, 0, 0),
+(255, 128, 0),
+(255, 255, 0)]
+# (128, 255, 0),
+# (0, 255, 0),
+# (0, 255, 128),
+# (0, 255, 255),
+# (0, 128, 255),
+# (0, 0, 255),
+# (127, 0, 255),
+# (255, 0, 255),
+# (255, 0, 127),
+# (128, 128, 128)] # 画图时候的颜色,随便设置即可
+)
+
+num_classes = 3
+train_batch_size_per_gpu = 32
+train_num_workers = 10
+persistent_workers = True
+base_lr = 0.004
+max_epochs = 300
+num_epochs_stage2 = 20
+model_test_cfg = dict(
+ multi_label=True,
+ nms_pre=30000,
+ score_thr=0.001,
+ nms=dict(type='nms', iou_threshold=0.65),
+ max_per_img=300)
+img_scale = (640, 640)
+random_resize_ratio_range = (0.5, 2.0)
+mosaic_max_cached_images = 20
+mixup_max_cached_images = 10
+dataset_type = 'YOLOv5CocoDataset'
+val_batch_size_per_gpu = 32
+val_num_workers = 10
+batch_shapes_cfg = dict(
+ type='BatchShapePolicy',
+ batch_size=32,
+ img_size=640,
+ size_divisor=32,
+ extra_pad_ratio=0.5)
+deepen_factor = 0.167
+widen_factor = 0.375
+strides = [8, 16, 32]
+norm_cfg = dict(type='BN')
+lr_start_factor = 1e-05
+dsl_topk = 13
+loss_cls_weight = 1.0
+loss_bbox_weight = 2.0
+qfl_beta = 2.0
+weight_decay = 0.05
+save_checkpoint_intervals = 10
+val_interval_stage2 = 1
+max_keep_ckpts = 3
+load_from = '/project/train/src_repo/mmyolo/tools/pth/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth'
+model = dict(
+ type='YOLODetector',
+ data_preprocessor=dict(
+ type='YOLOv5DetDataPreprocessor',
+ mean=[103.53, 116.28, 123.675],
+ std=[57.375, 57.12, 58.395],
+ bgr_to_rgb=False),
+ backbone=dict(
+ type='CSPNeXt',
+ arch='P5',
+ expand_ratio=0.5,
+ deepen_factor=0.167,
+ widen_factor=0.375,
+ channel_attention=True,
+ norm_cfg=dict(type='BN'),
+ act_cfg=dict(type='SiLU', inplace=True),
+ init_cfg=dict(
+ type='Pretrained',
+ prefix='backbone.',
+ checkpoint=
+ 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-tiny_imagenet_600e.pth',
+ map_location='cpu')),
+ neck=dict(
+ type='CSPNeXtPAFPN',
+ deepen_factor=0.167,
+ widen_factor=0.375,
+ in_channels=[256, 512, 1024],
+ out_channels=256,
+ num_csp_blocks=3,
+ expand_ratio=0.5,
+ norm_cfg=dict(type='BN'),
+ act_cfg=dict(type='SiLU', inplace=True)),
+ bbox_head=dict(
+ type='RTMDetHead',
+ head_module=dict(
+ type='RTMDetSepBNHeadModule',
+ num_classes=3,
+ in_channels=256,
+ stacked_convs=2,
+ feat_channels=256,
+ norm_cfg=dict(type='BN'),
+ act_cfg=dict(type='SiLU', inplace=True),
+ share_conv=True,
+ pred_kernel_size=1,
+ featmap_strides=[8, 16, 32],
+ widen_factor=0.375),
+ prior_generator=dict(
+ type='mmdet.MlvlPointGenerator', offset=0, strides=[8, 16, 32]),
+ bbox_coder=dict(type='DistancePointBBoxCoder'),
+ loss_cls=dict(
+ type='mmdet.QualityFocalLoss',
+ use_sigmoid=True,
+ beta=2.0,
+ loss_weight=1.0),
+ loss_bbox=dict(type='mmdet.GIoULoss', loss_weight=2.0)),
+ train_cfg=dict(
+ assigner=dict(
+ type='BatchDynamicSoftLabelAssigner',
+ num_classes=3,
+ topk=13,
+ iou_calculator=dict(type='mmdet.BboxOverlaps2D')),
+ allowed_border=-1,
+ pos_weight=-1,
+ debug=False),
+ test_cfg=dict(
+ multi_label=True,
+ nms_pre=30000,
+ score_thr=0.001,
+ nms=dict(type='nms', iou_threshold=0.65),
+ max_per_img=300))
+train_pipeline = [
+ dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
+ dict(type='LoadAnnotations', with_bbox=True),
+ dict(
+ type='Mosaic',
+ img_scale=(640, 640),
+ use_cached=True,
+ max_cached_images=20,
+ random_pop=False,
+ pad_val=114.0),
+ dict(
+ type='mmdet.RandomResize',
+ scale=(1280, 1280),
+ ratio_range=(0.5, 2.0),
+ resize_type='mmdet.Resize',
+ keep_ratio=True),
+ dict(type='mmdet.RandomCrop', crop_size=(640, 640)),
+ dict(type='mmdet.YOLOXHSVRandomAug'),
+ dict(type='mmdet.RandomFlip', prob=0.5),
+ dict(type='mmdet.Pad', size=(640, 640), pad_val=dict(img=(114, 114, 114))),
+ dict(
+ type='YOLOv5MixUp',
+ use_cached=True,
+ random_pop=False,
+ max_cached_images=10,
+ prob=0.5),
+ dict(type='mmdet.PackDetInputs')
+]
+train_pipeline_stage2 = [
+ dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
+ dict(type='LoadAnnotations', with_bbox=True),
+ dict(
+ type='mmdet.RandomResize',
+ scale=(640, 640),
+ ratio_range=(0.5, 2.0),
+ resize_type='mmdet.Resize',
+ keep_ratio=True),
+ dict(type='mmdet.RandomCrop', crop_size=(640, 640)),
+ dict(type='mmdet.YOLOXHSVRandomAug'),
+ dict(type='mmdet.RandomFlip', prob=0.5),
+ dict(type='mmdet.Pad', size=(640, 640), pad_val=dict(img=(114, 114, 114))),
+ dict(type='mmdet.PackDetInputs')
+]
+test_pipeline = [
+ dict(type='LoadImageFromFile', file_client_args=dict(backend='disk')),
+ dict(type='YOLOv5KeepRatioResize', scale=(640, 640)),
+ dict(
+ type='LetterResize',
+ scale=(640, 640),
+ allow_scale_up=False,
+ pad_val=dict(img=114)),
+ dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
+ dict(
+ type='mmdet.PackDetInputs',
+ meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor', 'pad_param'))
+]
+train_dataloader = dict(
+ batch_size=16,
+ num_workers=4,
+ persistent_workers=True,
+ pin_memory=True,
+ collate_fn=dict(type='yolov5_collate'),
+ sampler=dict(type='DefaultSampler', shuffle=True),
+ dataset=dict(
+ type='YOLOv5CocoDataset',
+ metainfo = metainfo,
+ data_root='/project/train/src_repo/',
+ ann_file='coco_annotations/instances_train2014.json',
+ data_prefix=dict(img='dataset/images'),
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
+ pipeline=[
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=dict(backend='disk')),
+ dict(type='LoadAnnotations', with_bbox=True),
+ dict(
+ type='Mosaic',
+ img_scale=(640, 640),
+ use_cached=True,
+ max_cached_images=20,
+ random_pop=False,
+ pad_val=114.0),
+ dict(
+ type='mmdet.RandomResize',
+ scale=(1280, 1280),
+ ratio_range=(0.5, 2.0),
+ resize_type='mmdet.Resize',
+ keep_ratio=True),
+ dict(type='mmdet.RandomCrop', crop_size=(640, 640)),
+ dict(type='mmdet.YOLOXHSVRandomAug'),
+ dict(type='mmdet.RandomFlip', prob=0.5),
+ dict(
+ type='mmdet.Pad',
+ size=(640, 640),
+ pad_val=dict(img=(114, 114, 114))),
+ dict(
+ type='YOLOv5MixUp',
+ use_cached=True,
+ random_pop=False,
+ max_cached_images=10,
+ prob=0.5),
+ dict(type='mmdet.PackDetInputs')
+ ]))
+val_dataloader = dict(
+ batch_size=16,
+ num_workers=4,
+ persistent_workers=True,
+ pin_memory=True,
+ drop_last=False,
+ sampler=dict(type='DefaultSampler', shuffle=False),
+ dataset=dict(
+ type='YOLOv5CocoDataset',
+ metainfo = metainfo,
+ data_root='/project/train/src_repo/',
+ ann_file='coco_annotations/instances_train2014.json',
+ data_prefix=dict(img='dataset/images'),
+ test_mode=True,
+ batch_shapes_cfg=dict(
+ type='BatchShapePolicy',
+ batch_size=32,
+ img_size=640,
+ size_divisor=32,
+ extra_pad_ratio=0.5),
+ pipeline=[
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=dict(backend='disk')),
+ dict(type='YOLOv5KeepRatioResize', scale=(640, 640)),
+ dict(
+ type='LetterResize',
+ scale=(640, 640),
+ allow_scale_up=False,
+ pad_val=dict(img=114)),
+ dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
+ dict(
+ type='mmdet.PackDetInputs',
+ meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor', 'pad_param'))
+ ]))
+test_dataloader = dict(
+ batch_size=16,
+ num_workers=4,
+ persistent_workers=True,
+ pin_memory=True,
+ drop_last=False,
+ sampler=dict(type='DefaultSampler', shuffle=False),
+ dataset=dict(
+ type='YOLOv5CocoDataset',
+ metainfo = metainfo,
+ data_root='/project/train/src_repo/',
+ ann_file='coco_annotations/instances_train2014.json',
+ data_prefix=dict(img='dataset/images'),
+ test_mode=True,
+ batch_shapes_cfg=dict(
+ type='BatchShapePolicy',
+ batch_size=32,
+ img_size=640,
+ size_divisor=32,
+ extra_pad_ratio=0.5),
+ pipeline=[
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=dict(backend='disk')),
+ dict(type='YOLOv5KeepRatioResize', scale=(640, 640)),
+ dict(
+ type='LetterResize',
+ scale=(640, 640),
+ allow_scale_up=False,
+ pad_val=dict(img=114)),
+ dict(type='LoadAnnotations', with_bbox=True, _scope_='mmdet'),
+ dict(
+ type='mmdet.PackDetInputs',
+ meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
+ 'scale_factor', 'pad_param'))
+ ]))
+val_evaluator = dict(
+ type='mmdet.CocoMetric',
+ proposal_nums=(100, 1, 10),
+ ann_file='/project/train/src_repo/coco_annotations/instances_train2014.json',
+ metric='bbox')
+test_evaluator = dict(
+ type='mmdet.CocoMetric',
+ proposal_nums=(100, 1, 10),
+ ann_file='/project/train/src_repo/coco_annotations/instances_train2014.json',
+ metric='bbox')
+optim_wrapper = dict(
+ type='OptimWrapper',
+ optimizer=dict(type='AdamW', lr=0.004, weight_decay=0.05),
+ paramwise_cfg=dict(
+ norm_decay_mult=0, bias_decay_mult=0, bypass_duplicate=True))
+param_scheduler = [
+ dict(
+ type='LinearLR', start_factor=1e-05, by_epoch=False, begin=0,
+ end=1000),
+ dict(
+ type='CosineAnnealingLR',
+ eta_min=0.0002,
+ begin=150,
+ end=300,
+ T_max=150,
+ by_epoch=True,
+ convert_to_iter_based=True)
+]
+custom_hooks = [
+ dict(
+ type='EMAHook',
+ ema_type='ExpMomentumEMA',
+ momentum=0.0002,
+ update_buffers=True,
+ strict_load=False,
+ priority=49),
+ dict(
+ type='mmdet.PipelineSwitchHook',
+ switch_epoch=280,
+ switch_pipeline=[
+ dict(
+ type='LoadImageFromFile',
+ file_client_args=dict(backend='disk')),
+ dict(type='LoadAnnotations', with_bbox=True),
+ dict(
+ type='mmdet.RandomResize',
+ scale=(640, 640),
+ ratio_range=(0.5, 2.0),
+ resize_type='mmdet.Resize',
+ keep_ratio=True),
+ dict(type='mmdet.RandomCrop', crop_size=(640, 640)),
+ dict(type='mmdet.YOLOXHSVRandomAug'),
+ dict(type='mmdet.RandomFlip', prob=0.5),
+ dict(
+ type='mmdet.Pad',
+ size=(640, 640),
+ pad_val=dict(img=(114, 114, 114))),
+ dict(type='mmdet.PackDetInputs')
+ ])
+]
+train_cfg = dict(
+ type='EpochBasedTrainLoop',
+ max_epochs=600,
+ val_interval=10,
+ dynamic_intervals=[(280, 1)])
+val_cfg = dict(type='ValLoop')
+test_cfg = dict(type='TestLoop')
+checkpoint = 'https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-tiny_imagenet_600e.pth'
+launcher = 'none'
+work_dir = '/project/train/models/train/exp/weights'
diff --git a/cvmart/Helmet_identification_10163/run.sh b/cvmart/Helmet_identification_10163/run.sh
new file mode 100644
index 00000000..d4d5e8e4
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/run.sh
@@ -0,0 +1,4 @@
+cp /home/data/831/*.jpg /project/train/src_repo/dataset/images
+python /project/train/src_repo/convert_to_coco.py
+#执行YOLOV5训练脚本
+python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
\ No newline at end of file
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 2ff8ad99..76499ace 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -1,18 +1,197 @@
-# cvmart competition baseline
+# 极市打榜-安全帽识别-新手任务(白银榜)
-# the first job
+## 打榜链接:https://cvmart.net/topList/10163?tab=RealTime
-## fd
+## 操作流程
+1、点击开发者工作台
-### dfs
+
+

+
-
+2、创建实例
+
+

+
-```python
+3、选择训练套件
-print(123123)
+
+

+
-```
\ No newline at end of file
+解释:由于没法通过git clone 下载相应的MMLAB的软件包,我们接下来采用极市平台上手动下载的方式。
+
+
+

+
+
+
+4、下载open-mmlab/playground的软件包,拖进资产管理/我的文件里面
+
+下载地址:https://github.com/open-mmlab/playground
+
+
+

+
+
+
+

+
+
+
+

+
+
+5、复制 playground 软件包的地址,接着在VSCode终端,采用 的方式下载 playground 的软件包
+
+
+

+
+
+
+6、点击在线编码->选择VSCode->点击确定,进入 VSCode 编辑页面
+
+
+

+
+
+7、打开VSCode终端,输入下面代码指令。
+```linux
+wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/9a3f2b18-a4e8-4470-8a13-3415f8bc3e41/playground-main.zip(该地址即为刚才复制的playground的软件包地址)
+```
+
+

+
+
+
+

+
+
+
+

+
+
+8、同上面下载 playground 软件包操作一样,将 mmyolo 的软件包,也下载到极市的VSCode平台里面
+
+下载地址:https://github.com/open-mmlab/mmyolo
+
+
+

+
+
+
+

+
+
+```linux
+wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/ca0f112a-9f5e-444c-97e7-433e7e2e3f56/mmyolo-main.zip(该地址即为刚才复制的 mmyolo 的软件包地址)
+```
+
+
+

+
+
+9、同上面下载软件包操作一样,将预训练权重,也下载到极市的VSCode平台里面
+
+下载地址:https://download.openmmlab.com/mmyolo/v0/rtmdet/rtmdet_tiny_syncbn_fast_8xb32-300e_coco/rtmdet_tiny_syncbn_fast_8xb32-300e_coco_20230102_140117-dbb1dc83.pth
+
+
+

+
+
+
+

+
+
+```linux
+wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/f05a6660-d240-4a28-85fc-eef11d374038/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth(该地址即为刚才复制的 mmyolo 的软件包地址)
+```
+
+
+

+
+
+10、输入下面指令,将 playground-main 和 mmyolo-main 软件包解压,重命名 playground-main 文件为 playground ,重命名 mmyolo-main 文件为 mmyolo 并且复制放到 train/src_repo 路径下面。
+
+```linux
+unzip playground-main.zip
+unzip mmyolo-main.zip
+mv playground-main playground
+mv mmyolo-main mmyolo
+cp -r playground train/src_repo
+cp -r mmyolo train/src_repo
+cp
+```
+
+11、执行下面指令,创建所需文件夹,并将 playground 文件里面的 run.sh ji.py convert_to_coco.py 以及预训练权重复制相应的位置。
+
+```linux
+mkdir /project/ev_sdk/src
+mkdir /project/train/src_repo/dataset/images
+mkdir /project/train/src_repo/mmyolo/pth
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/ji.py /project/ev_sdk/src
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/run.sh /project/train/src_repo
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/convert_to_coco.py /project/train/src_repo
+cp -r train/src_repo/playground/cvmart/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py /project/train/src_repo/mmyolo/tools
+cp -r rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth /project/train/src_repo/mmyolo/pth/
+```
+
+12、首先在VSCode终端执行一下训练程序,验证是否能跑起来
+
+```linux
+bash /project/train/src_repo/run.sh
+```
+
+如果运行之后,如下图效果所示,则配置成功
+
+
+

+
+
+13、用极市的官方平台执行训练任务。
+
+
+

+
+
+执行之后,等待它训练完成
+
+
+

+
+
+14、测试训练得到的模型,
+
+训练完成之后,可以在我们的模型列表里面查看我们训练得到的模型。
+
+
+

+
+
+点击模型测试,发起模型测试,选择我们要测试的模型对应的训练任务ID,找到我们想要测试的模型。
+
+
+

+
+
+注意,我们的模型是放在 /project/train/models/train/exp/weights 路径下面的,请在该路径下寻找 pth 文件
+
+
+

+
+
+注意,如果你要测试的是 /project/train/models/train/exp/weights/epoch_320.pth 模型,那么请保证你的 /project/ev_sdk/src/ji.py 文件里面对应的路径也是 /project/train/models/train/exp/weights/epoch_320.pth。一般来说,你每次测试的模型的名称不同,你都需要将 /project/ev_sdk/src/ji.py 文件对应的路径修改成对应的路径。
+
+
+

+
+
+15、查看测试的结果
+
+
+

+
\ No newline at end of file
diff --git a/cvmart/safe_hat_1000xx/config.py b/cvmart/safe_hat_1000xx/config.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/cvmart/safe_hat_1000xx/xxxxx.sh b/cvmart/safe_hat_1000xx/xxxxx.sh
deleted file mode 100644
index e69de29b..00000000
From 564eb43fd5c29c355695612e4c446f978b445974 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Wed, 10 May 2023 03:13:41 +0800
Subject: [PATCH 05/28] docs update readme
---
cvmart/readme.md | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 76499ace..581f2a07 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -107,6 +107,13 @@ wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-f
+注意,由于文件全名不能超过50个字符,请将预训练权重的名称改为:rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth,然后再上传文件。
+
+
+

+
+
+
```linux
wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/f05a6660-d240-4a28-85fc-eef11d374038/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth(该地址即为刚才复制的 mmyolo 的软件包地址)
```
@@ -123,24 +130,35 @@ unzip mmyolo-main.zip
mv playground-main playground
mv mmyolo-main mmyolo
cp -r playground train/src_repo
-cp -r mmyolo train/src_repo
-cp
+cp -r mmyolo train/src_repo
```
11、执行下面指令,创建所需文件夹,并将 playground 文件里面的 run.sh ji.py convert_to_coco.py 以及预训练权重复制相应的位置。
```linux
mkdir /project/ev_sdk/src
+mkdir /project/train/src_repo/dataset
mkdir /project/train/src_repo/dataset/images
-mkdir /project/train/src_repo/mmyolo/pth
+mkdir /project/train/src_repo/coco_annotations
+touch /project/train/src_repo/coco_annotations/instances_train2014.json
+mkdir /project/train/src_repo/mmyolo/tools/pth
cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/ji.py /project/ev_sdk/src
cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/run.sh /project/train/src_repo
cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/convert_to_coco.py /project/train/src_repo
-cp -r train/src_repo/playground/cvmart/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py /project/train/src_repo/mmyolo/tools
-cp -r rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth /project/train/src_repo/mmyolo/pth/
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py /project/train/src_repo/mmyolo/tools
+cp -r rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth /project/train/src_repo/mmyolo/tools/pth/
+```
+12、安装所需要的安装包
+
+```linux
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U openmim
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
+mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmengine
+mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmyolo
+mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmcv
```
-12、首先在VSCode终端执行一下训练程序,验证是否能跑起来
+13、首先在VSCode终端执行一下训练程序,验证是否能跑起来
```linux
bash /project/train/src_repo/run.sh
@@ -152,7 +170,7 @@ bash /project/train/src_repo/run.sh
-13、用极市的官方平台执行训练任务。
+14、用极市的官方平台执行训练任务。

@@ -164,7 +182,7 @@ bash /project/train/src_repo/run.sh
-14、测试训练得到的模型,
+15、测试训练得到的模型,
训练完成之后,可以在我们的模型列表里面查看我们训练得到的模型。
@@ -190,7 +208,7 @@ bash /project/train/src_repo/run.sh
-15、查看测试的结果
+16、查看测试的结果

From 7b94cd33c122ad2b40728c7405956a8bf3decadc Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Wed, 10 May 2023 07:09:28 +0800
Subject: [PATCH 06/28] docs update readme
---
cvmart/readme.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 581f2a07..a6edd5d7 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -153,6 +153,7 @@ cp -r rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth /project/train/src_repo/mmyolo
```linux
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U openmim
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xml
mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmengine
mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmyolo
mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmcv
From 201742b8e424df0b07adf4a31528ebef476b77d1 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Fri, 12 May 2023 05:44:26 +0800
Subject: [PATCH 07/28] docs update readme
---
cvmart/readme.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 69 insertions(+), 2 deletions(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index a6edd5d7..e6f31d6c 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -174,7 +174,7 @@ bash /project/train/src_repo/run.sh
14、用极市的官方平台执行训练任务。
-

+
执行之后,等待它训练完成
@@ -183,6 +183,16 @@ bash /project/train/src_repo/run.sh
+模型跑起来之后,可以通过点击【实时日志】查看训练过程的数据。
+
+
+

+
+
+
+

+
+
15、测试训练得到的模型,
训练完成之后,可以在我们的模型列表里面查看我们训练得到的模型。
@@ -213,4 +223,61 @@ bash /project/train/src_repo/run.sh

-
\ No newline at end of file
+
+
+
+## 使用 TensorBoard 实现训练过程的可视化
+
+首先修改配置文件:在 rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py 中, Contrl + F 搜索 visualizer 。
+
+
+

+
+
+找到该段代码之后, 将 修改为
+
+
+

+
+
+
+### 针对样本数据训练过程的可视化
+
+说明: 由于极市的数据具有保密性,所以我们能在 VSCode 终端执行训练的只有样本数据。
+
+1、在 VSCode 终端执行下面指令训练样本,用样本数据训练模型。
+
+```linux
+bash /project/train/src_repo/run.sh
+```
+
+训练得到的模型,以及训练日志文件都会保存在 /project/train/models/train/exp/weights 路径下
+
+
+

+
+
+2、在 VSCode 终端执行下面指令,打开 Tensorboard 可视化工具。
+
+```linux
+bash /project/train/src_repo/run.sh
+```
+
+如果你想要一边训练,一边就能实现训练过程的可视化,那么请点击下图中的【+】再打开一个 VSCode 终端窗口。
+
+
+

+
+
+然后在新的 VSCode 终端窗口,执行 。然后点击 Open in Browser。
+
+
+

+
+
+如此,便得到我们想要的可视化效果了。
+
+
+

+
From 0e8cb074bd3d9e57051c2fbdd3a09d775fbf0940 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Fri, 12 May 2023 05:52:18 +0800
Subject: [PATCH 08/28] docs update readme
---
cvmart/readme.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index e6f31d6c..c4f4a4b6 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -236,6 +236,10 @@ bash /project/train/src_repo/run.sh
找到该段代码之后, 将 修改为
+```python
+vis_backends=[dict(type='LocalVisBackend'), dict(type='TensorboardVisBackend')]
+```
+
From 3c2b622a051ec6b96f1820427a7c88d503927b74 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Fri, 12 May 2023 05:54:55 +0800
Subject: [PATCH 09/28] docs update readme
---
cvmart/readme.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index c4f4a4b6..907d909b 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -270,8 +270,7 @@ bash /project/train/src_repo/run.sh
如果你想要一边训练,一边就能实现训练过程的可视化,那么请点击下图中的【+】再打开一个 VSCode 终端窗口。
-

+
然后在新的 VSCode 终端窗口,执行 。然后点击 Open in Browser。
From 21c18295bd09d5e0f44c3b4a9e91ea8403ae9f48 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Fri, 12 May 2023 05:56:58 +0800
Subject: [PATCH 10/28] docs update readme
---
cvmart/readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 907d909b..36e52faf 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -279,7 +279,7 @@ bash /project/train/src_repo/run.sh
-如此,便得到我们想要的可视化效果了。
+如此,便得到基于样本数据训练的可视化效果了。

From 6c9e2e0c8c5ff6be1c3c1573198224fc7bc0cb24 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 05:17:06 +0800
Subject: [PATCH 11/28] docs update readme and python update move_log
---
cvmart/Helmet_identification_10163/move_log.py | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 cvmart/Helmet_identification_10163/move_log.py
diff --git a/cvmart/Helmet_identification_10163/move_log.py b/cvmart/Helmet_identification_10163/move_log.py
new file mode 100644
index 00000000..38561c64
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/move_log.py
@@ -0,0 +1,6 @@
+import os
+if os.path.exists('/project/train/tensorboard'):
+ os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
+else:
+ os.system('mkdir /project/train/tensorboard')
+ os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
\ No newline at end of file
From 5225fe1b2b67ccf656acfe96c1f20f2f86ab66d6 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 05:52:42 +0800
Subject: [PATCH 12/28] docs update readme
---
cvmart/readme.md | 66 ++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 36e52faf..473adbc8 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -23,14 +23,14 @@
-解释:由于没法通过git clone 下载相应的MMLAB的软件包,我们接下来采用极市平台上手动下载的方式。
+解释:由于没法通过 git clone 下载相应的MMLAB的软件包,我们接下来采用极市平台上手动下载的方式。
-4、下载open-mmlab/playground的软件包,拖进资产管理/我的文件里面
+4、下载 open-mmlab/playground 的软件包,拖进资产管理/我的文件里面
下载地址:https://github.com/open-mmlab/playground
@@ -60,7 +60,7 @@
7、打开VSCode终端,输入下面代码指令。
-```linux
+```shell
wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/9a3f2b18-a4e8-4470-8a13-3415f8bc3e41/playground-main.zip(该地址即为刚才复制的playground的软件包地址)
```
@@ -87,7 +87,7 @@ wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-f
-```linux
+```shell
wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/ca0f112a-9f5e-444c-97e7-433e7e2e3f56/mmyolo-main.zip(该地址即为刚才复制的 mmyolo 的软件包地址)
```
@@ -114,7 +114,7 @@ wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-f
-```linux
+```shell
wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-files/f05a6660-d240-4a28-85fc-eef11d374038/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth(该地址即为刚才复制的 mmyolo 的软件包地址)
```
@@ -124,7 +124,7 @@ wget https://extremevision-js-userfile.oss-cn-hangzhou.aliyuncs.com/user-35679-f
10、输入下面指令,将 playground-main 和 mmyolo-main 软件包解压,重命名 playground-main 文件为 playground ,重命名 mmyolo-main 文件为 mmyolo 并且复制放到 train/src_repo 路径下面。
-```linux
+```shell
unzip playground-main.zip
unzip mmyolo-main.zip
mv playground-main playground
@@ -135,7 +135,7 @@ cp -r mmyolo train/src_repo
11、执行下面指令,创建所需文件夹,并将 playground 文件里面的 run.sh ji.py convert_to_coco.py 以及预训练权重复制相应的位置。
-```linux
+```shell
mkdir /project/ev_sdk/src
mkdir /project/train/src_repo/dataset
mkdir /project/train/src_repo/dataset/images
@@ -150,7 +150,7 @@ cp -r rtmdet_tiny_syncbn_fast_8xb32-300e_coco.pth /project/train/src_repo/mmyolo
```
12、安装所需要的安装包
-```linux
+```shell
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U openmim
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple xml
@@ -161,7 +161,7 @@ mim install -i https://pypi.tuna.tsinghua.edu.cn/simple mmcv
13、首先在VSCode终端执行一下训练程序,验证是否能跑起来
-```linux
+```shell
bash /project/train/src_repo/run.sh
```
@@ -251,7 +251,7 @@ vis_backends=[dict(type='LocalVisBackend'), dict(type='TensorboardVisBackend')]
1、在 VSCode 终端执行下面指令训练样本,用样本数据训练模型。
-```linux
+```shell
bash /project/train/src_repo/run.sh
```
@@ -263,7 +263,7 @@ bash /project/train/src_repo/run.sh
2、在 VSCode 终端执行下面指令,打开 Tensorboard 可视化工具。
-```linux
+```shell
bash /project/train/src_repo/run.sh
```
@@ -284,3 +284,47 @@ bash /project/train/src_repo/run.sh
+
+### 针对极市官方封装的全数据训练过程的可视化
+
+说明,如果没有专门对 mmyolo 的可视化进行相应的适配,那么会出现下面的情况,即无法通过官方的启动功能,正常打开Tensorboard:
+
+
+

+
+
+1、首先将 run.sh 的内容删除,替换为下面的内容:
+
+```shell
+rm -rf /project/train/models/train/exp/weights
+mkdir /project/train/models/train/exp/weights
+rm -rf /project/train/tensorboard
+
+cp /home/data/831/*.jpg /project/train/src_repo/dataset/images
+python /project/train/src_repo/convert_to_coco.py
+
+python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
+python /project/train/src_repo/move_log.py
+tensorboard --logdir=/project/train/tensorboard
+```
+
+2、在 VSCode 终端,执行下面指令,将 move_log.py 复制到指定的文件夹:
+
+```shell
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/move_log.py /project/train/src_repo
+```
+
+3、首先在 VSCode 终端,执行下面指令,用样本数据跑一下,看是否能跑通:
+
+```shell
+bash /project/train/src_repo/run.sh
+```
+
+4、样本数据跑完之后,然后点击【】,即可得到样本数据训练的可视化结果,说明我们的配置没有问题。
+
+5、用极市官方封装的数据,训练我们的模型,并查看可视化效果。
+
+
+
+
+
From 6ed243a70d1c46bbc451a9208cf3e5c7a9b2bf66 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 05:54:36 +0800
Subject: [PATCH 13/28] sh update run
---
cvmart/Helmet_identification_10163/run.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/run.sh b/cvmart/Helmet_identification_10163/run.sh
index d4d5e8e4..5d120d6a 100644
--- a/cvmart/Helmet_identification_10163/run.sh
+++ b/cvmart/Helmet_identification_10163/run.sh
@@ -1,4 +1,8 @@
+rm -rf /project/train/models/train/exp/weights
+mkdir /project/train/models/train/exp/weights
+rm -rf /project/train/tensorboard
+
cp /home/data/831/*.jpg /project/train/src_repo/dataset/images
python /project/train/src_repo/convert_to_coco.py
-#执行YOLOV5训练脚本
+
python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
\ No newline at end of file
From 8742a22211046671cafd6224955d14f6a745feaf Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 05:55:53 +0800
Subject: [PATCH 14/28] docs update readme
---
cvmart/readme.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 473adbc8..5b7e9bbd 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -38,10 +38,12 @@
+
+
From 0bf9c141e622ee4e432115a691ded69f995091c1 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 05:59:34 +0800
Subject: [PATCH 15/28] docs update readme
---
cvmart/readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 5b7e9bbd..82ac1660 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -289,7 +289,7 @@ bash /project/train/src_repo/run.sh
### 针对极市官方封装的全数据训练过程的可视化
-说明,如果没有专门对 mmyolo 的可视化进行相应的适配,那么会出现下面的情况,即无法通过官方的启动功能,正常打开Tensorboard:
+说明,如果没有专门对 mmyolo 的可视化进行相应的适配,那么会出现下面的情况,即无法通过官方的启动功能正常打开Tensorboard:

From f56276b9d6ee10eb5f2870b15abeaadf3913afcb Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sat, 13 May 2023 06:04:24 +0800
Subject: [PATCH 16/28] docs update readme
---
cvmart/readme.md | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 82ac1660..c7fae8e0 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -322,7 +322,16 @@ cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/move_log.py /
bash /project/train/src_repo/run.sh
```
-4、样本数据跑完之后,然后点击【】,即可得到样本数据训练的可视化结果,说明我们的配置没有问题。
+4、样本数据跑完之后,然后点击【Open in Browser】,即可得到样本数据训练的可视化结果(下图为 300 个 epoch 的效果),说明我们的配置没有问题。
+
+
+

+
+
+
+

+
+
5、用极市官方封装的数据,训练我们的模型,并查看可视化效果。
From 727cf423316163f8372dd095695e1e8e5cdd2fe9 Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sun, 14 May 2023 21:49:02 +0800
Subject: [PATCH 17/28] python tensorboard
---
cvmart/Helmet_identification_10163/is_there_tensorboard.py | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 cvmart/Helmet_identification_10163/is_there_tensorboard.py
diff --git a/cvmart/Helmet_identification_10163/is_there_tensorboard.py b/cvmart/Helmet_identification_10163/is_there_tensorboard.py
new file mode 100644
index 00000000..67596096
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/is_there_tensorboard.py
@@ -0,0 +1,7 @@
+import os
+if os.path.exists('/project/train/tensorboard'):
+ # os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
+ os.system('rm -rf /project/train/tensorboard')
+else:
+ os.system('mkdir /project/train/tensorboard')
+ # os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
\ No newline at end of file
From 7bbc65bb62e4c8ae23e69ce6cf914f4ca7ec366d Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Sun, 14 May 2023 23:40:01 +0800
Subject: [PATCH 18/28] docs update readme
---
cvmart/readme.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index c7fae8e0..fc1c535b 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -335,6 +335,19 @@ bash /project/train/src_repo/run.sh
5、用极市官方封装的数据,训练我们的模型,并查看可视化效果。
+
+

+
+
+
+

+
+
+
+

+
+
+
From 19661c5397f5b12adef3e29ac96d68c7e222074b Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Mon, 15 May 2023 00:01:44 +0800
Subject: [PATCH 19/28] docs update readme and python update move_model
---
.../Helmet_identification_10163/move_model.py | 7 ++++
cvmart/readme.md | 42 +++++++++++++++----
2 files changed, 42 insertions(+), 7 deletions(-)
create mode 100644 cvmart/Helmet_identification_10163/move_model.py
diff --git a/cvmart/Helmet_identification_10163/move_model.py b/cvmart/Helmet_identification_10163/move_model.py
new file mode 100644
index 00000000..ef293234
--- /dev/null
+++ b/cvmart/Helmet_identification_10163/move_model.py
@@ -0,0 +1,7 @@
+import os
+if os.path.exists('/project/train/tensorboard'):
+ # os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
+ os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
+else:
+ os.system('mkdir /project/train/tensorboard')
+ os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
\ No newline at end of file
diff --git a/cvmart/readme.md b/cvmart/readme.md
index fc1c535b..c3ed3b1c 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -287,7 +287,7 @@ bash /project/train/src_repo/run.sh
-### 针对极市官方封装的全数据训练过程的可视化
+### 针对极市官方封装的全数据训练过程的可视化(可以一边训练,一边实现可视化)
说明,如果没有专门对 mmyolo 的可视化进行相应的适配,那么会出现下面的情况,即无法通过官方的启动功能正常打开Tensorboard:
@@ -298,22 +298,34 @@ bash /project/train/src_repo/run.sh
1、首先将 run.sh 的内容删除,替换为下面的内容:
```shell
+python /project/train/src_repo/is_there_tensorboard.py
+python /project/train/src_repo/is_there_tensorboard.py
+
rm -rf /project/train/models/train/exp/weights
mkdir /project/train/models/train/exp/weights
-rm -rf /project/train/tensorboard
+
cp /home/data/831/*.jpg /project/train/src_repo/dataset/images
python /project/train/src_repo/convert_to_coco.py
python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
+
+
python /project/train/src_repo/move_log.py
-tensorboard --logdir=/project/train/tensorboard
+# tensorboard --logdir=/project/train/tensorboard
```
-2、在 VSCode 终端,执行下面指令,将 move_log.py 复制到指定的文件夹:
+2、在 VSCode 终端,执行下面指令,将 move_log.py 和 is_there_tensorboard.py 复制到指定的文件夹:
```shell
-cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/move_log.py /project/train/src_repo
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/move_model.py /project/train/src_repo
+cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/is_there_tensorboard.py /project/train/src_repo
+```
+
+3、修改配置文件,打开 rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py 将最后一行改为下面代码:
+
+```python
+work_dir = '/project/train/tensorboard'
```
3、首先在 VSCode 终端,执行下面指令,用样本数据跑一下,看是否能跑通:
@@ -322,10 +334,26 @@ cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/move_log.py /
bash /project/train/src_repo/run.sh
```
-4、样本数据跑完之后,然后点击【Open in Browser】,即可得到样本数据训练的可视化结果(下图为 300 个 epoch 的效果),说明我们的配置没有问题。
+正常跑起来的效果如下图所示:
+
+

+
+
+
+4、样本数据跑的过程中,至少跑 10 个 epoch 之后,新建一个 VSCode 终端,执行下面指令:
+
+```shell
+tensorboard --logdir=/project/train/tensorboard
+```
+
+
+

+
+
+5、然后点击【Open in Browser】,即可得到样本数据训练的可视化结果(下图为 300 个 epoch 的效果),说明我们的配置没有问题。
-

+
From 325bd08a6e3485d686c08e193e232583c45899cc Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Mon, 15 May 2023 00:03:40 +0800
Subject: [PATCH 20/28] docs update readme
---
cvmart/readme.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index c3ed3b1c..74e1adaf 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -328,7 +328,7 @@ cp -r train/src_repo/playground/cvmart/Helmet_identification_10163/is_there_tens
work_dir = '/project/train/tensorboard'
```
-3、首先在 VSCode 终端,执行下面指令,用样本数据跑一下,看是否能跑通:
+4、首先在 VSCode 终端,执行下面指令,用样本数据跑一下,看是否能跑通:
```shell
bash /project/train/src_repo/run.sh
@@ -340,7 +340,7 @@ bash /project/train/src_repo/run.sh
-4、样本数据跑的过程中,至少跑 10 个 epoch 之后,新建一个 VSCode 终端,执行下面指令:
+5、样本数据跑的过程中,至少跑 10 个 epoch 之后,新建一个 VSCode 终端,执行下面指令:
```shell
tensorboard --logdir=/project/train/tensorboard
@@ -350,7 +350,7 @@ tensorboard --logdir=/project/train/tensorboard
-5、然后点击【Open in Browser】,即可得到样本数据训练的可视化结果(下图为 300 个 epoch 的效果),说明我们的配置没有问题。
+6、然后点击【Open in Browser】,即可得到样本数据训练的可视化结果(下图为 300 个 epoch 的效果),说明我们的配置没有问题。

@@ -361,7 +361,7 @@ tensorboard --logdir=/project/train/tensorboard
-5、用极市官方封装的数据,训练我们的模型,并查看可视化效果。
+7、用极市官方封装的数据,训练我们的模型,并查看可视化效果。

From 9b201cd935fb53c429edafa72c6a8c71348dcd7a Mon Sep 17 00:00:00 2001
From: geoffreyfan <3563678218@qq.com>
Date: Mon, 15 May 2023 01:15:40 +0800
Subject: [PATCH 21/28] docs update readme
---
cvmart/readme.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 74e1adaf..99e8c628 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -1,5 +1,7 @@
# 极市打榜-安全帽识别-新手任务(白银榜)
+本教程及相关脚本代码由社区同学 @geoffreyfan 贡献~
+
## 打榜链接:https://cvmart.net/topList/10163?tab=RealTime
From 383d33e8b138c56da6fe76a4630ac93f91d86644 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:52:13 +0800
Subject: [PATCH 22/28] Update readme.md
---
cvmart/readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cvmart/readme.md b/cvmart/readme.md
index 99e8c628..91658c60 100644
--- a/cvmart/readme.md
+++ b/cvmart/readme.md
@@ -1,6 +1,6 @@
# 极市打榜-安全帽识别-新手任务(白银榜)
-本教程及相关脚本代码由社区同学 @geoffreyfan 贡献~
+本教程和相关脚本代码由社区同学 @geoffreyfan 贡献~
## 打榜链接:https://cvmart.net/topList/10163?tab=RealTime
From 418db1231415f83a95c157ede4e4c4a312a3dd61 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:52:53 +0800
Subject: [PATCH 23/28] Update move_log.py
---
cvmart/Helmet_identification_10163/move_log.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/move_log.py b/cvmart/Helmet_identification_10163/move_log.py
index 38561c64..0b945552 100644
--- a/cvmart/Helmet_identification_10163/move_log.py
+++ b/cvmart/Helmet_identification_10163/move_log.py
@@ -1,6 +1,7 @@
import os
+
if os.path.exists('/project/train/tensorboard'):
os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
else:
os.system('mkdir /project/train/tensorboard')
- os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
\ No newline at end of file
+ os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
From 12c35501c70e124a82517abb85c60ab657ca07b5 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:55:48 +0800
Subject: [PATCH 24/28] Update convert_to_coco.py
---
cvmart/Helmet_identification_10163/convert_to_coco.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/convert_to_coco.py b/cvmart/Helmet_identification_10163/convert_to_coco.py
index 6dd832fe..5d683d4e 100644
--- a/cvmart/Helmet_identification_10163/convert_to_coco.py
+++ b/cvmart/Helmet_identification_10163/convert_to_coco.py
@@ -7,6 +7,7 @@
import json
import shutil
import numpy as np
+
import xml.etree.ElementTree as ET
path2 = "."
@@ -149,4 +150,4 @@ def convert(xml_list, json_file):
f2.close()
print("-------------------------------")
print("train number:", len(xml_list_train))
- print("val number:", len(xml_list_val))
\ No newline at end of file
+ print("val number:", len(xml_list_val))
From 3e59c0e452a30c91d1060a9b5a7ccea29d92cba6 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:56:05 +0800
Subject: [PATCH 25/28] Update is_there_tensorboard.py
---
cvmart/Helmet_identification_10163/is_there_tensorboard.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/is_there_tensorboard.py b/cvmart/Helmet_identification_10163/is_there_tensorboard.py
index 67596096..0b1d8c85 100644
--- a/cvmart/Helmet_identification_10163/is_there_tensorboard.py
+++ b/cvmart/Helmet_identification_10163/is_there_tensorboard.py
@@ -1,7 +1,8 @@
import os
+
if os.path.exists('/project/train/tensorboard'):
# os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
os.system('rm -rf /project/train/tensorboard')
else:
os.system('mkdir /project/train/tensorboard')
- # os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
\ No newline at end of file
+ # os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
From a920d7deba0433a983237b165601b72c5fa09395 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:56:26 +0800
Subject: [PATCH 26/28] Update ji.py
---
cvmart/Helmet_identification_10163/ji.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/ji.py b/cvmart/Helmet_identification_10163/ji.py
index 83c6a900..d9ace9a5 100644
--- a/cvmart/Helmet_identification_10163/ji.py
+++ b/cvmart/Helmet_identification_10163/ji.py
@@ -2,6 +2,7 @@
from mmdet.apis import init_detector, inference_detector
import mmcv
+
# from mmdet_custom.datasets import D10007Dataset
def init():
@@ -98,4 +99,4 @@ def process_image(handle=None, input_image=None, args=None, **kwargs):
# 或者 img = mmcv.imread(img), 这将只加载图像一次.
img = "/home/data/831/helmet_10809.jpg"
- process_image(handle, img, '{"mask_output_path": "result.png"}')
\ No newline at end of file
+ process_image(handle, img, '{"mask_output_path": "result.png"}')
From b795ac8ac4e97390e92bb6c8517f482826115896 Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:56:52 +0800
Subject: [PATCH 27/28] Update move_model.py
---
cvmart/Helmet_identification_10163/move_model.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/move_model.py b/cvmart/Helmet_identification_10163/move_model.py
index ef293234..0e701231 100644
--- a/cvmart/Helmet_identification_10163/move_model.py
+++ b/cvmart/Helmet_identification_10163/move_model.py
@@ -1,7 +1,8 @@
import os
+
if os.path.exists('/project/train/tensorboard'):
# os.system('cp -r /project/train/models/train/exp/weights/* /project/train/tensorboard/')
os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
else:
os.system('mkdir /project/train/tensorboard')
- os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
\ No newline at end of file
+ os.system('cp -r /project/train/tensorboard/* /project/train/models/train/exp/weights/')
From 533d43c7c964e35b76330bad9f2a7ae7b07d617b Mon Sep 17 00:00:00 2001
From: geoffreyfan <105597268+geoffreyfan@users.noreply.github.com>
Date: Fri, 14 Jul 2023 14:57:08 +0800
Subject: [PATCH 28/28] Update run.sh
---
cvmart/Helmet_identification_10163/run.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cvmart/Helmet_identification_10163/run.sh b/cvmart/Helmet_identification_10163/run.sh
index 5d120d6a..1a789611 100644
--- a/cvmart/Helmet_identification_10163/run.sh
+++ b/cvmart/Helmet_identification_10163/run.sh
@@ -1,8 +1,9 @@
rm -rf /project/train/models/train/exp/weights
+
mkdir /project/train/models/train/exp/weights
rm -rf /project/train/tensorboard
cp /home/data/831/*.jpg /project/train/src_repo/dataset/images
python /project/train/src_repo/convert_to_coco.py
-python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py
\ No newline at end of file
+python /project/train/src_repo/mmyolo/tools/train.py /project/train/src_repo/mmyolo/tools/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py