PaddleDetection icon indicating copy to clipboard operation
PaddleDetection copied to clipboard

[Other General Issues]训练自定义数据集报错

Open dengxinlong opened this issue 5 years ago • 9 comments

描述问题

使用paddleDetection训练自定义数据集(VisDrone-coco格式)报类型错误,在初始训练的时候正常,训练到3000iter时候报错,同时,模型也是在iter为3000的时候进行eval和保存。

复现

  1. 使用的命令:
python tools/train.py -c configs/ssd/ssdlite_mobilenet_v3_large_fpn.yml --eval
  1. 配置文件已经更改
architecture: SSD
use_gpu: true
max_iters: 80000
snapshot_iter: 3000
log_iter: 20
metric: COCO
pretrain_weights: pretrainWeights/MobileNetV3_large_x1_0_ssld_fpn_pretrained
save_dir: output
weights: output/ssdlite_mobilenet_v3_large_fpn/model_final
# 80(label_class) + 1(background)
num_classes: 13

SSD:
  backbone: MobileNetV3
  fpn: FPN
  multi_box_head: SSDLiteMultiBoxHead
  output_decoder:
    background_label: 0
    keep_top_k: 200
    nms_eta: 1.0
    nms_threshold: 0.45
    nms_top_k: 400
    score_threshold: 0.01

FPN:
  num_chan: 256
  max_level: 7
  norm_type: bn
  norm_decay: 0.00004
  reverse_out: true

MobileNetV3:
  scale: 1.0
  model_name: large
  extra_block_filters: [[256, 512], [128, 256], [128, 256], [64, 128]]
  feature_maps: [5, 7, 8, 9, 10, 11]
  lr_mult_list: [0.25, 0.25, 0.5, 0.5, 0.75]
  conv_decay: 0.00004

SSDLiteMultiBoxHead:
  aspect_ratios: [[2.], [2., 3.], [2., 3.], [2., 3.], [2., 3.], [2., 3.]]
  base_size: 320
  steps: [16, 32, 64, 107, 160, 320]
  flip: true
  clip: true
  max_ratio: 95
  min_ratio: 20
  offset: 0.5
  conv_decay: 0.00004

LearningRate:
  base_lr: 0.001
  schedulers:
  - !PiecewiseDecay
    gamma: 0.1
    milestones: [54000, 74000]

OptimizerBuilder:
  optimizer:
    momentum: 0.9
    type: Momentum
  regularizer:
    factor: 0.0005
    type: L2

TrainReader:
  inputs_def:
    image_shape: [3, 320, 320]
    fields: ['image', 'gt_bbox', 'gt_class']
  dataset:
    !COCODataSet
    dataset_dir: dataset/VisDrone
    anno_path: annotations/train.json
    image_dir: images
  sample_transforms:
  - !DecodeImage
    to_rgb: true
  - !RandomDistort
    brightness_lower: 0.875
    brightness_upper: 1.125
    is_order: true
  - !RandomExpand
    fill_value: [123.675, 116.28, 103.53]
  - !RandomCrop
    allow_no_crop: false
  - !NormalizeBox {}
  - !ResizeImage
    interp: 1
    target_size: 320
    use_cv2: false
  - !RandomFlipImage
    is_normalized: false
  - !NormalizeImage
    mean: [0.485, 0.456, 0.406]
    std: [0.229, 0.224, 0.225]
    is_scale: true
    is_channel_first: false
  - !Permute
    to_bgr: false
    channel_first: true
  batch_size: 64
  shuffle: true
  drop_last: true
  # Number of working threads/processes. To speed up, can be set to 16 or 32 etc.
  worker_num: 8
  # Size of shared memory used in result queue. After increasing `worker_num`, need expand `memsize`.
  memsize: 8G
  # Buffer size for multi threads/processes.one instance in buffer is one batch data.
  # To speed up, can be set to 64 or 128 etc.
  bufsize: 32
  use_process: true


EvalReader:
  inputs_def:
    image_shape: [3, 320, 320]
    fields: ['image', 'gt_bbox', 'gt_class', 'im_shape', 'im_id']
  dataset:
    !COCODataSet
    dataset_dir: dataset/VisDrone
    anno_path: annotations/val.json
    image_dir: images
  sample_transforms:
  - !DecodeImage
    to_rgb: true
  - !NormalizeBox {}
  - !ResizeImage
    interp: 1
    target_size: 320
    use_cv2: false
  - !NormalizeImage
    mean: [0.485, 0.456, 0.406]
    std: [0.229, 0.224, 0.225]
    is_scale: true
    is_channel_first: false
  - !Permute
    to_bgr: false
    channel_first: True
  batch_size: 8
  worker_num: 8
  bufsize: 32
  use_process: false

TestReader:
  inputs_def:
    image_shape: [3,320,320]
    fields: ['image', 'im_id', 'im_shape']
  dataset:
    !ImageFolder
    anno_path: annotations/instances_val2017.json
  sample_transforms:
  - !DecodeImage
    to_rgb: true
  - !ResizeImage
    interp: 1
    max_size: 0
    target_size: 320
    use_cv2: true
  - !NormalizeImage
    mean: [0.485, 0.456, 0.406]
    std: [0.229, 0.224, 0.225]
    is_scale: true
    is_channel_first: false
  - !Permute
    to_bgr: false
    channel_first: True
  batch_size: 1
  1. 使用的数据集 VisDrone,已经转换为coco格式

  2. 请提供您出现的报错信息及相关log

2021-11-08 23:41:33,716 - INFO - iter: 2940, lr: 0.001000, 'loss': '5.255873', eta: 3 days, 3:51:36, batch_cost: 3.54394 sec, ips: 18.05897 images/sec
2021-11-08 23:42:28,978 - INFO - iter: 2960, lr: 0.001000, 'loss': '5.213574', eta: 2 days, 9:54:33, batch_cost: 2.70605 sec, ips: 23.65075 images/sec
2021-11-08 23:43:39,939 - INFO - iter: 2980, lr: 0.001000, 'loss': '5.223286', eta: 3 days, 3:53:01, batch_cost: 3.54689 sec, ips: 18.04395 images/sec
2021-11-08 23:44:38,596 - INFO - iter: 3000, lr: 0.001000, 'loss': '5.132401', eta: 2 days, 15:49:54, batch_cost: 2.98434 sec, ips: 21.44524 images/sec
2021-11-08 23:44:38,609 - INFO - Save model to output/ssdlite_mobilenet_v3_large_fpn/3000.
/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py:1288: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
  logging.warn('Your reader has raised an exception!')
2021-11-08 23:44:42,558 - WARNING - Your reader has raised an exception!
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:299: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  status = self._base[start:end].tostring().decode()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/shared_queue/sharedmemory.py:253: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  header_str = self._base[0:self.s_allocator_header].tostring()
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:89: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  if isinstance(item, collections.Sequence) and len(item) == 0:
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:50: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  format(f, e, str(stack_info)))
2021-11-08 23:44:43,144 - WARNING - fail to map op [RandomExpand_4b7968] with error: int() argument must be a string, a bytes-like object or a number, not 'Image' and stack:
Traceback (most recent call last):
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py", line 46, in __call__
    data = f(data, ctx)
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/transform/operators.py", line 1779, in __call__
    canvas[y:y + height, x:x + width, :] = img.astype(np.uint8)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'Image'

Traceback (most recent call last):
  File "tools/train.py", line 399, in <module>
    main()
  File "tools/train.py", line 316, in main
    resolution=resolution)
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/utils/eval_utils.py", line 148, in eval_run
Exception in thread Thread-12:
Traceback (most recent call last):
  File "/home/dai/.conda/envs/dxl/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/dai/.conda/envs/dxl/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 1289, in __thread_main__
    six.reraise(*sys.exc_info())
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 1269, in __thread_main__
    for tensors in self._tensor_reader():
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 1348, in __tensor_reader_impl__
    for slots in paddle_reader():
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/data_feeder.py", line 551, in __reader_creator__
    yield self.feed(item)
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/data_feeder.py", line 392, in feed
    ret_dict[each_name] = each_converter.done()
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/data_feeder.py", line 199, in done
    arr = np.array(self.data, dtype=self.dtype)
ValueError: invalid literal for int() with base 10: '0000280_01001_d_0000617'

    return_numpy=False)
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1110, in run
    six.reraise(*sys.exc_info())
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1108, in run
    return_merged=return_merged)
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1251, in _run_impl
    return_merged=return_merged)
  File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/executor.py", line 913, in _run_parallel
    tensors = exe.run(fetch_var_names, return_merged)._move_to_list()
SystemError: In user code:

    File "tools/train.py", line 399, in <module>
      main()
    File "tools/train.py", line 163, in main
      feed_vars, eval_loader = model.build_inputs(**inputs_def)
    File "/home/dai/xinlongdeng/PaddleDetection/ppdet/modeling/architectures/ssd.py", line 155, in build_inputs
      iterable=iterable) if use_dataloader else None
    File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 749, in from_generator
      iterable, return_list, drop_last)
    File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 1119, in __init__
      self._init_non_iterable()
    File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/reader.py", line 1221, in _init_non_iterable
      attrs={'drop_last': self._drop_last})
    File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/framework.py", line 3027, in append_op
      attrs=kwargs.get("attrs", None))
    File "/home/dai/.conda/envs/dxl/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2107, in __init__
      for frame in traceback.extract_stack():

    FatalError: Blocking queue is killed because the data reader raises an exception.
      [Hint: Expected killed_ != true, but received killed_:1 == true:1.] (at /paddle/paddle/fluid/operators/reader/blocking_queue.h:158)
      [operator < read > error]
/home/dai/xinlongdeng/PaddleDetection/ppdet/data/parallel_map.py:243: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  .format(sample.errmsg))
2021-11-08 23:44:43,213 - WARNING - recv endsignal from outq with errmsg[consumer[consumer-b4d-4] failed to map with error:[int() argument must be a string, a bytes-like object or a number, not 'Image']]

环境/Environment

  1. Paddle版本:2.0.2

  2. 请提供您使用的操作系统信息:Linux version 3.10.0-1062.12.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Feb 4 23:02:59 UTC 2020

  3. 使用的Python版本:3.7.10

dengxinlong avatar Nov 09 '21 02:11 dengxinlong

/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py:50: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead format(f, e, str(stack_info))) 2021-11-08 23:44:43,144 - WARNING - fail to map op [RandomExpand_4b7968] with error: int() argument must be a string, a bytes-like object or a number, not 'Image' and stack: Traceback (most recent call last): File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py", line 46, in call data = f(data, ctx) File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/transform/operators.py", line 1779, in call canvas[y:y + height, x:x + width, :] = img.astype(np.uint8) TypeError: int() argument must be a string, a bytes-like object or a number, not 'Image'

看起来部分数据读取的不对。 可能需要检查下数据格式。

qingqing01 avatar Nov 09 '21 05:11 qingqing01

确实,应该是数据转换成coco格式的时候存在问题,我再看看,感谢回复!

dengxinlong avatar Nov 09 '21 06:11 dengxinlong

下面是同事转换到COCO的脚本,也做了类别的合并,供参考:

import os
import cv2
from tqdm import tqdm
import json
 
 
def convert_to_cocodetection(dir, output_dir):
    train_dir = os.path.join(dir, "VisDrone2019-DET-train")
    val_dir = os.path.join(dir, "VisDrone2019-DET-val")
    train_annotations = os.path.join(train_dir, "annotations")
    val_annotations = os.path.join(val_dir, "annotations")
    train_images = os.path.join(train_dir, "images")
    val_images = os.path.join(val_dir, "images")
    id_num = 0
    
 
    categories = [{"id": 1, "name": "people"},
                  {"id": 2, "name": "bicycle"},
                  {"id": 3, "name": "car"},
                  {"id": 4, "name": "van"},
                  {"id": 5, "name": "truck"},
                  {"id": 6, "name": "tricycle"},
                  {"id": 7, "name": "awning-tricycle"},
                  {"id": 8, "name": "bus"},
                  {"id": 9, "name": "motor"}
                  ]
    for mode in ["train", "val"]:
        images = []
        annotations = []
        print(f"start loading {mode} data...")
        if mode == "train":
            set = os.listdir(train_annotations)
#             print(set)
            annotations_path = train_annotations
            images_path = train_images
        else:
            id_num=0
            set = os.listdir(val_annotations)
            annotations_path = val_annotations
            images_path = val_images
        for i in tqdm(set):
            if 'txt' in i:
                
                
#             print(f'{i}++++++++++++')
                f = open(annotations_path + "/" + i, "r")
                name = i.replace(".txt", "")
                name1 = name.replace('_','')
                name2 = name1.replace('d','')
                image = {}
                height, width = cv2.imread(images_path + "/" + name + ".jpg").shape[:2]
                file_name = name + ".jpg"
                image["file_name"] = file_name
                image["height"] = height
                image["width"] = width
                image["id"] = name2
                images.append(image)
                for line in f.readlines():
                    annotation = {}
                    line = line.replace("\n", "")
                    if line.endswith(","):  # filter data
                        line = line.rstrip(",")
                    line_list = [int(i) for i in line.split(",")]
                # import pdb; pdb.set_trace()
                    bbox_xywh = [line_list[0], line_list[1], line_list[2], line_list[3]]
                    annotation["image_id"] = name2
                # annotation["score"] = line_list[4]
                    annotation["bbox"] = bbox_xywh
                    annotation["category_id"] = int(line_list[5])
                    annotation["id"] = id_num
                    annotation["iscrowd"] = 0
                    annotation["segmentation"] = []
                    annotation["area"] = bbox_xywh[2] * bbox_xywh[3]
                    id_num += 1
                    annotations.append(annotation)
        dataset_dict = {}
        dataset_dict["images"] = images
        dataset_dict["annotations"] = annotations
        dataset_dict["categories"] = categories
        json_str = json.dumps(dataset_dict)
        with open(f'{output_dir}/VisDrone2019-DET_{mode}_coco.json', 'w') as json_file:
            json_file.write(json_str)
    print("json file write done...")
 
 
def get_test_namelist(dir, out_dir):
    full_path = out_dir + "/" + "test.txt"
    file = open(full_path, 'w')
    for name in tqdm(os.listdir(dir)):
        name = name.replace(".txt", "")
        file.write(name + "\n")
    file.close()
    return None
 
 
def centerxywh_to_xyxy(boxes):
    """
    args:
        boxes:list of center_x,center_y,width,height,
    return:
        boxes:list of x,y,x,y,cooresponding to top left and bottom right
    """
    x_top_left = boxes[0] - boxes[2] / 2
    y_top_left = boxes[1] - boxes[3] / 2
    x_bottom_right = boxes[0] + boxes[2] / 2
    y_bottom_right = boxes[1] + boxes[3] / 2
    return [x_top_left, y_top_left, x_bottom_right, y_bottom_right]
 
 
def centerxywh_to_topleftxywh(boxes):
    """
    args:
        boxes:list of center_x,center_y,width,height,
    return:
        boxes:list of x,y,x,y,cooresponding to top left and bottom right
    """
    x_top_left = boxes[0] - boxes[2] / 2
    y_top_left = boxes[1] - boxes[3] / 2
    width = boxes[2]
    height = boxes[3]
    return [x_top_left, y_top_left, width, height]
 
 
def clamp(coord, width, height):
    if coord[0] < 0:
        coord[0] = 0
    if coord[1] < 0:
        coord[1] = 0
    if coord[2] > width:
        coord[2] = width
    if coord[3] > height:
        coord[3] = height
    return coord
 
 
if __name__ == '__main__':
    convert_to_cocodetection("dataset/VisDrone2019", "dataset/VisDrone2019_coco")

qingqing01 avatar Nov 09 '21 09:11 qingqing01

好的,感谢,好像和我再网上找的转换代码差不多,有几个地方不同存在略微不同。 我采用的:https://blog.csdn.net/qq_20793791/article/details/110881657 类别上面的多了三种:"ignored regions“, "pedestrian", "others"; 我根据您提供的转换代码再看看,非常感谢回复!

dengxinlong avatar Nov 09 '21 09:11 dengxinlong

您好,根据您提供的转换脚本,还是存在读取文件问题:

creating index...
index created!
Traceback (most recent call last):
  File "tools/train.py", line 399, in <module>
    main()
  File "tools/train.py", line 167, in main
    eval_reader = create_reader(cfg.EvalReader, devices_num=1)
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py", line 442, in create_reader
    reader = Reader(**cfg)()
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/reader.py", line 210, in __init__
    self._roidbs = self._dataset.get_roidb()
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/source/dataset.py", line 68, in get_roidb
    self.load_roidb_and_cname2cid()
  File "/home/dai/xinlongdeng/PaddleDetection/ppdet/data/source/coco.py", line 162, in load_roidb_and_cname2cid
    gt_class[i][0] = catid2clsid[catid]
KeyError: 10

dengxinlong avatar Nov 09 '21 13:11 dengxinlong

看起来转换之后的类别总数、类别id不太对。

qingqing01 avatar Nov 10 '21 04:11 qingqing01

看起来转换之后的类别总数、类别id不太对。

换了一种方式,将这个数据集转换成VOC格式,然后利用PaddleDetection中的x2coco将VOC格式转换为coco格式,还是出现上面的问题。。。。。

dengxinlong avatar Nov 26 '21 06:11 dengxinlong

看起来转换之后的类别总数、类别id不太对。

我重新看了一下贵方的release2.3中的sniper模型,使用数据集就是VisDrone,也就是这样转换是可以的,不过我使用的是release2.0静态图版本,我切换到2.3的动态图版本看看

dengxinlong avatar Nov 30 '21 13:11 dengxinlong

请问最后怎么解决的这个问题呢?

看起来转换之后的类别总数、类别id不太对。

我重新看了一下贵方的release2.3中的sniper模型,使用数据集就是VisDrone,也就是这样转换是可以的,不过我使用的是release2.0静态图版本,我切换到2.3的动态图版本看看

wenzonghui avatar May 29 '22 12:05 wenzonghui