Git Product home page Git Product logo

drenet's Introduction

👋 About Me (CV)

I received my master's degree at LEVIR Group, Beihang University (BUAA) in January 2024, supervised by Prof. Zhenwei Shi and Prof. Zhengxia Zou. Previously, I received my bachelor’s degree from Beihang University in June 2021. Besides that, I was also a research intern at SenseTime working on content generation from May - Aug, 2023, supervised by Dr. Jianlou Si. My current research interests lie in 4D (human motion) generation, AISafety, image synthesis, and remote sensing image processing.

📎 Homepages

🔥 News

  • 2024.05: One paper is accepted by TGRS (IF=8.2)!
  • 2024.01: One paper is accepted by ICLR 2024 (Spotlight)!
  • 2023.12: One paper is accepted by TGRS (IF=8.2)!
  • 2023.10: One paper is accepted by TCSVT (IF=8.4)!
  • 2023.09: One paper is accepted by TGRS (IF=8.2)!
  • 2023.07: We have released Gradio Demo of our INR-Harmonization in Huggingface Space. Feel free to play around it 🎉🎉!
  • 2023.06: One paper is accepted by MICCAI (STAR Award)!
  • 2023.05: Honored to be invited to give talks about Diffusion Editing and Harmonization for OPPO Research Institute!
  • 2023.05: One paper is accepted by TGRS (IF=8.2)!
  • 2023.02: 1/2 papers are accepted by CVPR 2023, and one paper is accepted by CBM (IF=7.7)!
  • 2022.12: One paper is accepted by GRSL (IF=4.8)!
  • 2022.07: One paper is accepted by TGRS (IF=8.2)!
  • 2022.06: One paper is accepted by TGRS (IF=8.2)!
  • 2022.05: Achieve the 5th place in Track I: Classification Task Defense and the 6th place in Track II: Open Set Defense, CVPR 2022 Robust Models towards Open-world Classification 🎉🎉!

drenet's People

Contributors

windvchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

drenet's Issues

在yolov5-5.0中只使用CRMA模块

您好,从图中可以看到,我将所有尺寸都设置为640,然后只使用了您的CRMA添加到原生的yolov5 5.0版本中,yaml文件也做了相应的修改,但是还是在验证的时候报了错误,想问一下有可能是什么原因导致?
val
yaml
yolo
train

Adapt for yolov5l6

Hi,
would you mind suggesting me on how to adapt yolov5l6 using DRENet? below is the configuration for yolov5l6.

# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 80  # number of classes
depth_multiple: 1.0  # model depth multiple
width_multiple: 1.0  # layer channel multiple
anchors:
  - [19,27,  44,40,  38,94]  # P3/8
  - [96,68,  86,152,  180,137]  # P4/16
  - [140,301,  303,264,  238,542]  # P5/32
  - [436,615,  739,380,  925,792]  # P6/64

# YOLOv5 v6.0 backbone
backbone:
  # [from, number, module, args]
  [[-1, 1, Conv, [64, 6, 2, 2]],  # 0-P1/2
   [-1, 1, Conv, [128, 3, 2]],  # 1-P2/4
   [-1, 3, C3, [128]],
   [-1, 1, Conv, [256, 3, 2]],  # 3-P3/8
   [-1, 6, C3, [256]],
   [-1, 1, Conv, [512, 3, 2]],  # 5-P4/16
   [-1, 9, C3, [512]],
   [-1, 1, Conv, [768, 3, 2]],  # 7-P5/32
   [-1, 3, C3, [768]],
   [-1, 1, Conv, [1024, 3, 2]],  # 9-P6/64
   [-1, 3, C3, [1024]],
   [-1, 1, SPPF, [1024, 5]],  # 11
  ]

# YOLOv5 v6.0 head
head:
  [[-1, 1, Conv, [768, 1, 1]],
   [-1, 1, nn.Upsample, [None, 2, 'nearest']],
   [[-1, 8], 1, Concat, [1]],  # cat backbone P5
   [-1, 3, C3, [768, False]],  # 15

   [-1, 1, Conv, [512, 1, 1]],
   [-1, 1, nn.Upsample, [None, 2, 'nearest']],
   [[-1, 6], 1, Concat, [1]],  # cat backbone P4
   [-1, 3, C3, [512, False]],  # 19

   [-1, 1, Conv, [256, 1, 1]],
   [-1, 1, nn.Upsample, [None, 2, 'nearest']],
   [[-1, 4], 1, Concat, [1]],  # cat backbone P3
   [-1, 3, C3, [256, False]],  # 23 (P3/8-small)

   [-1, 1, Conv, [256, 3, 2]],
   [[-1, 20], 1, Concat, [1]],  # cat head P4
   [-1, 3, C3, [512, False]],  # 26 (P4/16-medium)

   [-1, 1, Conv, [512, 3, 2]],
   [[-1, 16], 1, Concat, [1]],  # cat head P5
   [-1, 3, C3, [768, False]],  # 29 (P5/32-large)

   [-1, 1, Conv, [768, 3, 2]],
   [[-1, 12], 1, Concat, [1]],  # cat head P6
   [-1, 3, C3, [1024, False]],  # 32 (P6/64-xlarge)

   [[23, 26, 29, 32], 1, Detect, [nc, anchors]],  # Detect(P3, P4, P5, P6)
  ]

Thank you

试运行detect.py上遇到的问题

老师,学长们好,我是一名研一学生,由于代码能力不足没能成功进行利用您的代码对LEVIR_SHIP进行预测,想向您提一点问题:
image
如图在detect.py中存在引用了未定义函数的情况,删去未定义的stride后,会出现似乎是尺寸不对应的问题,“RuntimeError: The size of tensor a (400) must match the size of tensor b (256) at non-singleton dimension 1”,请问该如何解决呢。

实验

您好学长,这里其他的对比模型没用写出来吗?比如ssd这些配置文件没用在代码里面吗?

RuntimeError: result type Float can't be cast to the desired output type long int

Hello Chen,
Thank you very much for taking your time to answer me! I appreciate!
When I run the training code train.py, I had the error:

Image sizes 512 train, 512 test
Using 8 dataloader workers
Logging results to LEVIR-Ship/exp2
Starting training for 1000 epochs...

 Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size

0%| | 0/145 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/la/Desktop/DRENet_ship/train.py", line 515, in
train(hyp, opt, device, tb_writer, wandb)
File "/home/la/Desktop/DRENet_ship/train.py", line 294, in train
loss, loss_items, adaptParams = compute_loss(pred, dgimgs.to(device), targets.to(device)) # loss scaled by batch_size
File "/home/la/Desktop/DRENet_ship/utils/loss.py", line 135, in call
tcls, tbox, indices, anchors = self.build_targets(p[0], targets) # targets
File "/home/la/Desktop/DRENet_ship/utils/loss.py", line 245, in build_targets
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type long int
wandb: Waiting for W&B process to finish... (failed 1). Press Control-C to abort syncing.

I did not change anything from your code. Could you please give me a solution to solve this problem. Thanks!

Best regards,

Tran-Vu

Good degradation configure for high resolution images

Hi,
my images are high resolution images with size around 5000 and 5000 (h and w). I run Degrade Generate but is very slows since the boxsize is relatively small. do you have suggestion about degradation configuration that fit better for my images? in term of speed and final performance.

please advice

thanks

关于C3ResAtnMHSA模块的问题

师兄您好!有幸阅读了您的论文。想请教两个问题:
一、由于我尝试过直接使用MHSA加入C3中,然后分别将C3-MHSA模块加入到和您的网络差不多的位置,但是发现显存占用很大。而您的模块加了那么多个地方是因为每次使用都把通道数降低了的,从而可以降低显存占用是吗?如下图,head中第一个C3ResAtnMHSA模块,输入512通道,输出32......
二、我如果直接使用您这个C3ResAtnMHSA模块将入到我的yolov5s改进的网络中,除了修改common和yolo的那两个文件以外,还有别的地方需要修改吗?我的输入图像是768大小的,就会报错。
1

performance decrease during training

Hi, do you have suggestion to overcome this problem during training ?

Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     0/199       11G    0.1279   0.01601         0  0.008378     2.849         6       512: 100%|█| 1800/1800 [14:48<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [01:07<00
30.39782691001892
                 all    2.75e+03    4.51e+03           0           0    5.13e-06    9.81e-07

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     1/199       11G    0.1261   0.01524         0  0.005636     2.846         6       512: 100%|█| 1800/1800 [14:03<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [01:01<00
31.465840816497803
                 all    2.75e+03    4.51e+03           0           0    3.55e-06    6.64e-07

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     2/199       11G    0.1214   0.01546         0  0.005382     2.844        14       512: 100%|█| 1800/1800 [13:46<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [01:03<00
32.228920221328735
                 all    2.75e+03    4.51e+03       0.321       0.297       0.194      0.0497

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     3/199       11G    0.1142   0.01436         0  0.005227     2.839        20       512: 100%|█| 1800/1800 [13:39<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:58<00
28.6451997756958
                 all    2.75e+03    4.51e+03       0.316       0.485       0.345      0.0999

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     4/199       11G   0.09978   0.01415         0  0.005147     2.832         7       512: 100%|█| 1800/1800 [13:23<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:57<00
28.444270849227905
                 all    2.75e+03    4.51e+03       0.408       0.578       0.472       0.167

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     5/199       11G   0.09265   0.01457         0  0.005125     2.829         5       512: 100%|█| 1800/1800 [13:32<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [01:02<00
30.84639859199524
                 all    2.75e+03    4.51e+03       0.399       0.623       0.507       0.161

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     6/199       11G   0.08306   0.01727         0  0.005281     2.825        10       512: 100%|█| 1800/1800 [13:44<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [01:01<00
30.013824462890625
                 all    2.75e+03    4.51e+03       0.285       0.589       0.453       0.145

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     7/199       11G       nan       nan         0  0.005711       nan         6       512: 100%|█| 1800/1800 [13:36<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:51<00
31.282738208770752
                 all    2.75e+03    4.51e+03           0           0    1.57e-06    1.74e-07

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     8/199       11G       nan       nan         0       nan       nan        10       512: 100%|█| 1800/1800 [13:31<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:49<00
32.83151125907898
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
     9/199       11G       nan       nan         0       nan       nan         9       512: 100%|█| 1800/1800 [13:20<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:45<00
29.580291509628296
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    10/199       11G       nan       nan         0       nan       nan         4       512: 100%|█| 1800/1800 [13:25<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:48<00
32.03327965736389
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    11/199       11G       nan       nan         0       nan       nan         9       512: 100%|█| 1800/1800 [13:28<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:47<00
30.341226816177368
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    12/199       11G       nan       nan         0       nan       nan         2       512: 100%|█| 1800/1800 [13:11<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:45<00
29.359901189804077
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    13/199       11G       nan       nan         0       nan       nan        13       512: 100%|█| 1800/1800 [13:05<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:45<00
29.436581134796143
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    14/199       11G       nan       nan         0       nan       nan         7       512: 100%|█| 1800/1800 [13:04<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:45<00
29.631073713302612
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    15/199       11G       nan       nan         0       nan       nan         6       512: 100%|█| 1800/1800 [13:08<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:45<00
29.1485652923584
                 all    2.75e+03           0           0           0           0           0

     Epoch   gpu_mem       box       obj       cls       dgi     total   targets  img_size
    16/199       11G       nan       nan         0       nan       nan        18       512: 100%|█| 1800/1800 [13:14<00
               Class      Images     Targets           P           R      [email protected]  [email protected]:.95: 100%|█| 344/344 [00:46<00
29.673731088638306
                 all    2.75e+03           0           0           0           0           0

关于concatFusionFactor的问题

您好,我的数据是768*768,。请问我把concat替换为concatFusionFactor后,运行yolo.py,报如下的错误。应该还要改哪些地方呢?

D:\ProgramData\Anaconda3\envs\py38\python.exe D:/1bishe/yolov5-master2/models/yolo.py
models\yolo: cfg=yolov5s-biformer2-scale.yaml, batch_size=1, device=0, profile=False, line_profile=False, test=False
YOLOv5 2023-12-11 Python-3.8.18 torch-1.13.0+cu117 CUDA:0 (NVIDIA GeForce RTX 3060 Laptop GPU, 6144MiB)

             from  n    params  module                                  arguments                     

0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2]
1 -1 1 18560 models.common.Conv [32, 64, 3, 2]
2 -1 1 18816 models.common.C3 [64, 64, 1]
3 -1 1 73984 models.common.Conv [64, 128, 3, 2]
4 -1 2 115712 models.common.C3 [128, 128, 2]
5 -1 1 295424 models.common.Conv [128, 256, 3, 2]
6 -1 3 625152 models.common.C3 [256, 256, 3]
7 -1 1 1180672 models.common.Conv [256, 512, 3, 2]
8 -1 1 1182720 models.common.C3 [512, 512, 1]
9 -1 1 1055744 models.Biformer.BiLevelRoutingAttention [512]
10 -1 1 656896 models.common.SPPF [512, 512, 5]
11 -1 1 131584 models.common.Conv [512, 256, 1, 1]
12 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
13 [-1, 6] 1 1 models.common.ConcatFusionFactor [1]
14 -1 1 427520 models.common.C3 [768, 256, 1, False]
15 -1 1 33024 models.common.Conv [256, 128, 1, 1]
16 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
17 [-1, 4] 1 1 models.common.ConcatFusionFactor [1]
18 -1 1 107264 models.common.C3 [384, 128, 1, False]
19 -1 1 147712 models.common.Conv [128, 128, 3, 2]
20 [-1, 15] 1 1 models.common.ConcatFusionFactor [1]
21 -1 1 296448 models.common.C3 [256, 256, 1, False]
22 -1 1 590336 models.common.Conv [256, 256, 3, 2]
23 [-1, 11] 1 1 models.common.ConcatFusionFactor [1]
24 -1 1 1182720 models.common.C3 [512, 512, 1, False]
25 [18, 21, 24] 1 229245 Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]
Traceback (most recent call last):
File "D:/1bishe/yolov5-master2/models/yolo.py", line 391, in
model = Model(opt.cfg).to(device)
File "D:/1bishe/yolov5-master2/models/yolo.py", line 200, in init
m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward
File "D:/1bishe/yolov5-master2/models/yolo.py", line 199, in
forward = lambda x: self.forward(x)[0] if isinstance(m, Segment) else self.forward(x)
File "D:/1bishe/yolov5-master2/models/yolo.py", line 214, in forward
return self._forward_once(x, profile, visualize) # single-scale inference, train
File "D:/1bishe/yolov5-master2/models/yolo.py", line 125, in _forward_once
x = m(x) # run
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\1bishe\yolov5-master2\models\common.py", line 228, in forward
return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), 1))
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\1bishe\yolov5-master2\models\common.py", line 68, in forward
return self.act(self.bn(self.conv(x)))
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\ProgramData\Anaconda3\envs\py38\lib\site-packages\torch\nn\modules\conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Given groups=1, weight of size [128, 768, 1, 1], expected input[1, 512, 48, 48] to have 768 channels, but got 512 channels instead

关于测试标签

老师学长您好:
请问咱们这个网络在test或者detect中能不能生成标签啊,就是我想不仅要识别还想要定位。
感谢老师学长的解答

运行detect.py出错,您好我把C3ResAtnMHSA加入了yolov7中,出现下面的错误

Namespace(weights=['/content/runs/train/exp2/weights/last.pt'], source='/content/1_6306.jpg', img_size=640, conf_thres=0.25, iou_thres=0.2, device='0', view_img=False, save_txt=False, save_conf=False, nosave=False, classes=None, agnostic_nms=False, augment=False, update=False, project='runs/detect', name='exp', exist_ok=False, no_trace=False)
YOLOR 🚀 v0.1-122-g3b41c2c torch 1.9.1+cu111 CUDA:0 (Tesla T4, 15101.8125MB)

Fusing layers...
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
IDetect.fuse
Model Summary: 327 layers, 36431002 parameters, 6194944 gradients
Convert model to Traced-model...
/content/yolov7/models/common.py:2172: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if C != self.in_channels:
/content/yolov7/models/common.py:2131: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if C != self.in_channels:
/content/yolov7/models/common.py:2139: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if x.size(0)>1:
traced_script_module saved!
model is traced!

Traceback (most recent call last):
File "/content/yolov7/detect.py", line 196, in
detect()
File "/content/yolov7/detect.py", line 83, in detect
model(img, augment=opt.augment)[0]
File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/content/yolov7/utils/torch_utils.py", line 372, in forward
out = self.model(x)
File "/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
/content/yolov7/models/common.py(2052): forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1039): _slow_forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1051): _call_impl
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/container.py(139): forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1039): _slow_forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1051): _call_impl
/content/yolov7/models/common.py(2072): forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1039): _slow_forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1051): _call_impl
/content/yolov7/models/yolo.py(625): forward_once
/content/yolov7/models/yolo.py(599): forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1039): _slow_forward
/usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py(1051): _call_impl
/usr/local/lib/python3.9/dist-packages/torch/jit/_trace.py(952): trace_module
/usr/local/lib/python3.9/dist-packages/torch/jit/_trace.py(735): trace
/content/yolov7/utils/torch_utils.py(362): init
/content/yolov7/detect.py(39): detect
/content/yolov7/detect.py(196):
RuntimeError: The size of tensor a (320) must match the size of tensor b (400) at non-singleton dimension 1

use other yolov5 models

Hi, I wonder if I can use other yolov5 model (n,s,m,l,etc)? I have tried to use DRENet.yaml inside models folder. is it possible to use yaml file from yolov5 repo? do I need to do some modification?

please advise

thanks

DRENet model training on degraded images

Hi there,

I am not able to train the DRENet model using the degraded images. I have provided the degraded images path in the ship.yaml file as follows:
train: /content/gdrive/MyDrive/DRENet_new/DRENet/LEVIR_ship_dataset_full/train/degrade/
val: /content/gdrive/MyDrive/DRENet_new/DRENet/LEVIR_ship_dataset_full/val/degrade/

I get the following error message.

AssertionError: train: No labels in /content/gdrive/MyDrive/DRENet_new/DRENet/LEVIR_ship_dataset_full/train/degrade.cache. Can not train without labels.

Please advise if I am providing the incorrect file path. Looking forward to hearing from you.
Thanks.

train using different size of image

hi, I tried to use 417*417 images but it returns error message as follow :

File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\tqdm\std.py", line 1195, in __iter__
    for obj in iterable:
  File "C:\Users\Owner\slick\DRENet-main\utils\datasets.py", line 106, in __iter__
    yield next(self.iterator)
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\dataloader.py", line 521, in __next__
    data = self._next_data()
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\dataloader.py", line 1203, in _next_data
    return self._process_data(data)
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\dataloader.py", line 1229, in _process_data
    data.reraise()
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\_utils.py", line 434, in reraise
    raise exception
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\_utils\worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Owner\Anaconda3\envs\sit\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\Owner\slick\DRENet-main\utils\datasets.py", line 513, in __getitem__
    img, dgimg, labels = load_mosaic(self, index)
  File "C:\Users\Owner\slick\DRENet-main\utils\datasets.py", line 709, in load_mosaic
    dgimg4[y1a:y2a, x1a:x2a] = dgimg[y1b:y2b, x1b:x2b]
ValueError: could not broadcast input array from shape (174,417,3) into shape (268,511,3)

wandb: Waiting for W&B process to finish... (failed 1). Press Ctrl-C to abort syncing.
wandb:
wandb: Synced exp4: https://wandb.ai/rariwa/slick-project/runs/21eo5mg1
wandb: Synced 5 W&B file(s), 2 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: .\wandb\run-20220906_160742-21eo5mg1\logs

is there any lines that I need to modify or change to train with images other than 512*512?

thanks

detect.py

Why does detect.py have no results

Error when doing inference using augmentation

Hi, I got error when doing inference using augment=True. the error is shown as follow. please advise

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_53796\2715512915.py in <module>
     26                 postprocess_type  = "NMS",
     27                 postprocess_match_metric = "IOU",
---> 28                 perform_standard_pred=False)
     29         result_len = result.to_coco_annotations()
     30         for pred in result_len:

~\anaconda3\envs\bird\lib\site-packages\sahi\predict.py in get_sliced_prediction(image, detection_model, slice_height, slice_width, overlap_height_ratio, overlap_width_ratio, perform_standard_pred, postprocess_type, postprocess_match_metric, postprocess_match_threshold, postprocess_class_agnostic, verbose, merge_buffer_length, auto_slice_resolution)
    243             full_shape=[
    244                 slice_image_result.original_image_height,
--> 245                 slice_image_result.original_image_width,
    246             ],
    247         )

~\anaconda3\envs\bird\lib\site-packages\sahi\predict.py in get_prediction(image, detection_model, shift_amount, full_shape, postprocess, verbose)
     89     # get prediction
     90     time_start = time.time()
---> 91     detection_model.perform_inference(np.ascontiguousarray(image_as_pil))
     92     time_end = time.time() - time_start
     93     durations_in_seconds["prediction"] = time_end

~\AppData\Local\Temp\ipykernel_53796\30530663.py in perform_inference(self, img, image_size)
     23         with torch.no_grad():
     24             # Run model
---> 25             (out, train_out), pdg = self.model(img, augment=True)  # inference and training outputs
     26          # Run NMS
     27         prediction_result = non_max_suppression(out, conf_thres=self.confidence_threshold, iou_thres=self.iou_thres, labels=[], multi_label=True)

~\anaconda3\envs\bird\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
   1128         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1129                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1130             return forward_call(*input, **kwargs)
   1131         # Do not call functions when jit is used
   1132         full_backward_hooks, non_full_backward_hooks = [], []

~\birds\DRENet\models\yolo.py in forward(self, x, augment, profile)
    121                 yi = self.forward_once(xi)[0]  # forward
    122                 # cv2.imwrite('img%g.jpg' % s, 255 * xi[0].numpy().transpose((1, 2, 0))[:, :, ::-1])  # save
--> 123                 yi[..., :4] /= si  # de-scale
    124                 if fi == 2:
    125                     yi[..., 1] = img_size[0] - yi[..., 1]  # de-flip ud

TypeError: tuple indices must be integers or slices, not tuple

Thanks

Cannot run detect.py

Hello Chen,
I tried your code detect.py, but I always had a problem. Could you check it for me please! Thanks a lot!

(optic_ship) la@erin-tla-30122:~/Desktop/DRENet_ship$ python detect.py --weights "./DRENet.pt" --source "images/" --device cpu
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='cpu', exist_ok=False, img_size=512, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='images/', update=False, view_img=False, weights=['./DRENet.pt'])
YOLOv5 torch 1.13.1+cu117 CPU

Fusing layers...
Model Summary: 239 layers, 4788248 parameters, 0 gradients
image 1/1 /home/la/Desktop/DRENet_ship/images/GF1_WFV4_E124.3_N33.5_20200926_L1A0005089385_3584_8192.png: Traceback (most recent call last):
File "detect.py", line 175, in
detect()
File "detect.py", line 72, in detect
pred = model(img, augment=opt.augment)[0][0]
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/la/Desktop/DRENet_ship/models/yolo.py", line 131, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "/home/la/Desktop/DRENet_ship/models/yolo.py", line 148, in forward_once
x = m(x) # run
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/upsampling.py", line 157, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "/opt/anaconda3/envs/optic_ship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1270, in getattr
type(self).name, name))
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'

Problems in the ConcatFusionFactor of common.py

Hello, while reading your paper, you wrote: "Suppose that there are two layers C1 and C2 in the bottom-up pathway from shallow to deep, and two layers P1 and P2 in the top-down pathway corresponded. In the original FPN, P1 = C1 + upsample(P2); after we add the scale layer, it turns to be P1 = C1 + α× upsample(P2), where α is a learnable parameter." in methodology. I guess this is the function of the ConcatFusionFactor module, but in this module, this factor is 1.0 and It doesn't seem to change, or does it default to 1.0 and change elsewhere?

class ConcatFusionFactor(nn.Module):
    # Concatenate a list of tensors along dimension
    def __init__(self, dimension=1):
        super(ConcatFusionFactor, self).__init__()
        self.d = dimension
        self.factor=torch.nn.Parameter(torch.FloatTensor([1]))

    def forward(self, x):
        x[0] = x[0]*self.factor
        return torch.cat(x, self.d)

detect报错

您好,陈学长:
国庆节快乐!在假期的时候冒味打扰您了,我代码在pycharm里能运行出来,但由于我电脑算力不行,我放到了云服务器上,用vscode运行,遇到了这些错误
image
请问这些该如何解决,谢谢!国庆节快乐!

I cannot run DRENet. Because has a bug: RuntimeError: The size of tensor a (160) must match the size of tensor b (256) at non-singleton dimension 1

Traceback (most recent call last):
File "/home/leo/Desktop/small_object/DRENet/detect.py", line 176, in
detect()
File "/home/leo/Desktop/small_object/DRENet/detect.py", line 73, in detect
pred = model(img, augment=opt.augment)[0][0]
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/leo/Desktop/small_object/DRENet/models/yolo.py", line 131, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "/home/leo/Desktop/small_object/DRENet/models/yolo.py", line 148, in forward_once
x = m(x) # run
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/leo/Desktop/small_object/DRENet/models/common.py", line 208, in forward
return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), dim=1))
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/home/leo/anaconda3/envs/revolution/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
File "/home/leo/Desktop/small_object/DRENet/models/common.py", line 153, in forward
energy = content_content + content_position
RuntimeError: The size of tensor a (160) must match the size of tensor b (256) at non-singleton dimension 1

Pls help me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.