voldemortX / DST-CBC

Implementation of our Pattern Recognition paper "DMT: Dynamic Mutual Training for Semi-Supervised Learning"
BSD 3-Clause "New" or "Revised" License
135 stars 17 forks source link

迭代 #16

Open dqq813 opened 1 year ago

dqq813 commented 1 year ago

您好,请问迭代DMT的代码在哪里实现

voldemortX commented 1 year ago

@dqq813 每次迭代的逻辑是一样的 (pseudo label + training),所以是直接用shell文件调用python文件实现的,例如 https://github.com/voldemortX/DST-CBC/blob/master/segmentation/dmt-voc-20-1.sh

dqq813 commented 1 year ago

那请问可以使用coco数据集训练吗,我自己定义的数据集是coco格式的

voldemortX commented 1 year ago

@dqq813 目前没适配过coco格式训练,你可以看看需不需要修改dataset代码适配你自己的格式

dqq813 commented 1 year ago

您好,我在训练我自己的数据集时,出现了这个问题,请问应该怎么解决? /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [610,0,0], thread: [23,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [610,0,0], thread: [24,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [648,0,0], thread: [62,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [648,0,0], thread: [63,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [13,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [14,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [15,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [16,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [24,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [25,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [26,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [27,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [28,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [29,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. /pytorch/aten/src/ATen/native/cuda/ScatterGatherKernel.cu:86: operator(): block: [691,0,0], thread: [30,0,0] Assertion idx_dim >= 0 && idx_dim < index_size && "index out of bounds" failed. Traceback (most recent call last): File "main.py", line 507, in val_num_steps=args.val_num_steps, input_sizes=input_sizes) File "main.py", line 215, in train loss, stats = criterion(outputs, probs, inputs_c.shape[0]) File "/home/dqq/anaconda3/envs/dmt/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl result = self.forward(*input, *kwargs) File "/home/dqq/project/DST-CBC/segmentation/utils/losses.py", line 95, in forward stats['disagree'] = (disagreement (real_targets != self.ignore_index))[:split_index].sum().int().item() RuntimeError: CUDA error: device-side assert triggered

voldemortX commented 1 year ago

@dqq813 建议检查一下类别数量等修改有没有造成下标溢出

dqq813 commented 1 year ago

@dqq813 建议检查一下类别数量等修改有没有造成下标溢出

已解决,谢谢您

dqq813 commented 1 year ago

for key in coco: if 'layer5' in key: my_key = 'classifier.0.convs' + key.split('conv2d_list')[1] else: my_key = 'backbone.' + key if my_voc[my_key].shape == coco[key].shape: voc_shape_match += 1 my_voc[my_key] = coco[key] else: voc_shape_not_match += 1 if my_city[my_key].shape == coco[key].shape: city_shape_match += 1 my_city[my_key] = coco[key] else: city_shape_not_match += 1 您好,我想请问一下,这里为什么使用coco预训练权重中的layer5初始化deeplabv2中的classifier呢,如果想初始化deeplabv3中的classifier,应该使用哪层的权重初始化呢

voldemortX commented 1 year ago

for key in coco: if 'layer5' in key: my_key = 'classifier.0.convs' + key.split('conv2d_list')[1] else: my_key = 'backbone.' + key if my_voc[my_key].shape == coco[key].shape: voc_shape_match += 1 my_voc[my_key] = coco[key] else: voc_shape_not_match += 1 if my_city[my_key].shape == coco[key].shape: city_shape_match += 1 my_city[my_key] = coco[key] else: city_shape_not_match += 1 您好,我想请问一下,这里为什么使用coco预训练权重中的layer5初始化deeplabv2中的classifier呢,如果想初始化deeplabv3中的classifier,应该使用哪层的权重初始化呢

这个还真没研究过,估计是从第一篇半监督分割(Advsemiseg Hung et al. 你应该听说过吧)抄来的,为了保持统一。

dqq813 commented 1 year ago

for key in coco: if 'layer5' in key: my_key = 'classifier.0.convs' + key.split('conv2d_list')[1] else: my_key = 'backbone.' + key if my_voc[my_key].shape == coco[key].shape: voc_shape_match += 1 my_voc[my_key] = coco[key] else: voc_shape_not_match += 1 if my_city[my_key].shape == coco[key].shape: city_shape_match += 1 my_city[my_key] = coco[key] else: city_shape_not_match += 1 您好,我想请问一下,这里为什么使用coco预训练权重中的layer5初始化deeplabv2中的classifier呢,如果想初始化deeplabv3中的classifier,应该使用哪层的权重初始化呢

这个还真没研究过,估计是从第一篇半监督分割(Advsemiseg Hung et al. 你应该听说过吧)抄来的,为了保持统一。

好的,谢谢您,我去看一下。