MiniBullLab / easy_ai

3 stars 1 forks source link

segnet加载json文件的接口 #101

Closed foww-0001 closed 3 years ago

lpj0822 commented 3 years ago

已经完成

kingwangxiang commented 3 years ago

还有些问题,需要测试。数据集标准格式可能需要更改。

lpj0822 commented 3 years ago

开发完成

lpj0822 commented 3 years ago

测试

foww-0001 commented 3 years ago

报错如下:

2021-10-25 05:49:45,369 ERROR   [segnet_process.py, 65] /easy_data/dataset/Nut_segment/Annotations or /easy_data/dataset/Nut_segment/JPEGImages/train.txt not exists!
2021-10-25 05:49:55,813 WARNING [segment_sample.py, 29] /easy_data/dataset/Nut_segment/ImageSets/train.txt sample count: 0
2021-10-25 05:49:55,819 ERROR   [ai_train.py, 122] Traceback (most recent call last):
  File "/easy_data/easy_ai/easy_tools/model_train/ai_train.py", line 112, in segment_model_train
    segnet_process.resize_process(self.train_path)
  File "/easy_data/easy_ai/easy_tools/model_train/segnet_process.py", line 33, in resize_process
    segment_sample.read_sample()
  File "/easy_data/easy_ai/easyai/data_loader/seg/segment_sample.py", line 30, in read_sample
    assert self.sample_count > 0
AssertionError

显示Annotaions或JPEGImages文件没有,但目前数据集下存有这两个文件。

lpj0822 commented 3 years ago

已经修改

foww-0001 commented 3 years ago

拉取最新分支后,报错如下:

2021-10-25 08:00:50,354 ERROR   [evaluation_factory.py, 27] __init__() got an unexpected keyword argument 'num_class'
2021-10-25 08:00:50,501 ERROR   [dataloader_factory.py, 55] Traceback (most recent call last):
  File "/easy_data/easy_ai/easyai/data_loader/utility/dataloader_factory.py", line 32, in get_train_dataloader
    dataset = build_from_cfg(copy_dataset_config, REGISTERED_DATASET)
  File "/easy_data/easy_ai/easyai/utility/registry.py", line 109, in build_from_cfg
    return obj_cls(**args)
TypeError: __init__() got an unexpected keyword argument 'class_names'

2021-10-25 08:00:50,501 ERROR   [dataloader_factory.py, 56] __init__() got an unexpected keyword argument 'class_names'
foww-0001 commented 3 years ago

还有train.txt和val.txt的数据个数倒了过来,train.txt只有14张数据,而val.txt有86张数据。正在定位问题。

foww-0001 commented 3 years ago
            if (image is not None) and os.path.exists(label_path):
                if (imageIndex + 1) % probability == 0:
                    save_train_file_path.write("%s\n" % file_name_and_post)
                else:
                    save_test_file_path.write("%s\n" % file_name_and_post)

需要修改为:

            if (image is not None) and os.path.exists(label_path):
                if (imageIndex + 1) % probability == 0:
                    save_test_file_path.write("%s\n" % file_name_and_post)
                else:
                    save_train_file_path.write("%s\n" % file_name_and_post)
foww-0001 commented 3 years ago

删除config.json后继续运行:

2021-10-25 09:09:05,409 ERROR   [train_task.py, 43] Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/easy_data/easy_ai/easyai/data_loader/seg/segment_dataset.py", line 38, in __getitem__
    label = self.read_label_image(label_path)
  File "/easy_data/easy_ai/easyai/data_loader/seg/segment_dataset.py", line 58, in read_label_image
    self.class_names)
  File "/easy_data/easy_ai/easyai/tools/sample_tool/convert_segment_label.py", line 75, in process_segment_label
    mask = self.convert_color_label(mask, class_list)
  File "/easy_data/easy_ai/easyai/tools/sample_tool/convert_segment_label.py", line 119, in convert_color_label
    value_list = [int(x) for x in value[1].split(',') if x.strip()]
AttributeError: 'list' object has no attribute 'split'
lpj0822 commented 3 years ago

先测试其他的

lpj0822 commented 3 years ago

已经修改

MiniBullLab commented 3 years ago

报错如下:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/easy_data/easy_ai/easy_tools/easy_ai.py", line 75, in <module>
    train_main()
  File "/easy_data/easy_ai/easy_tools/easy_ai.py", line 64, in train_main
    train_process.segment_model_train(dir_name)
  File "/easy_data/easy_ai/easy_tools/model_train/ai_train.py", line 107, in segment_model_train
    class_names = segnet_process.label_process(self.train_path)
  File "/easy_data/easy_ai/easy_tools/model_train/segnet_process.py", line 61, in label_process
    TaskName.Segment_Task)
  File "/easy_data/easy_ai/easyai/tools/sample_tool/sample_info_get.py", line 43, in create_class_names
    color_str = ','.join(color)
TypeError: sequence item 0: expected str instance, int found
Failed to start easy_ai
foww-0001 commented 3 years ago

使用json进行seg的标注数据已经上传百度网盘。

lpj0822 commented 3 years ago

代码已经修改

foww-0001 commented 3 years ago

可以正常运行。