cwq159 / PyTorch-Spiking-YOLOv3

A PyTorch implementation of Spiking-YOLOv3. Two branches are provided, based on two common PyTorch implementation of YOLOv3(ultralytics/yolov3 & eriklindernoren/PyTorch-YOLOv3), with support for Spiking-YOLOv3-Tiny at present.
GNU General Public License v3.0
206 stars 58 forks source link

I try your code in two ways, i don't know how to 29.50% mAP,please help #10

Open HeuristicLU opened 3 years ago

HeuristicLU commented 3 years ago

I try your code in two ways in COCO2014 dataset,
1)in ultralytics/yolov3 branche , use cfg/yolov3-tiny-ours.cfg, i can reach 38.70% map, but I use "python3 ann_to_snn.py xx", yolov3-tiny-ours-snn is only 13.5% mAP. 2) in eriklindernoren/PyTorch-YOLOv3 branch, i can reach 13.3%, , but I use "python3 ann_to_snn.py xx", yolov3-tiny-ours-snn is only 0.21% mAP. i don't know why?

my GPU is 48G,in training my batch-size is setting 200 in ann_to_snn.py ,I set batch_size 1,and set timesteps 156,then get 13.5% mAP

HeuristicLU commented 3 years ago

你好,我是在COCO2014数据集上进行测试的,训练的batch_size是200,环境都是按照requires里面来的,使用ultralytics/yolov3分支的代码,然后用yolov3-tiny-mp2conv-mp1none-lk2relu-up2tconv.cfg配置文件进行训练,可以达到您论文里面说的38.7%的mAP,但是我在 ann_to_snn.py里面测的时候,发现SNN的mAP只有13.3%左右。 我原来是用pytorch1.7训练的,后来运行ann_to_snn.py的时候报错,我按照你的issue把环境降低了,我降到了pytorch1.4,然后把1.7训的模型作为预训练模型,在1.4上加载进来又多训练了一些轮次。 我用的显卡是英伟达RTX8000系列,内存48GB,ann_to_snn.py里面的batch_size你原来设置的是16,timesteps设置的是128,但是我运行时候报超内存,然后我不断尝试,发现batch_size小于8以内才不会报错,还有我把timesteps变长到156了。 我不知道为啥不行,麻烦您帮忙思考下我到底错在哪里了啊,谢啦

HeuristicLU commented 3 years ago

我又测试了voc格式的单类别红细胞数据集,用您修改后的配置文件训练map为76.5%,但是snn的评估mAP只有56.50%,搞不太清楚为啥,感觉我错的地方差不多

cwq159 commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

这版本的转换准确率受timesteps影响较大,你可以尽可能提高timesteps,比如128/256/512等等,你可以参考spiking-yolo这篇论文,他的timesteps甚至上千,你可以针对你的数据集或coco进行测试。

                            Weiqian Chen

                                cwq@pku.edu.cn

    签名由
    网易邮箱大师
    定制

On 02/20/2021 14:14,HeuristicLU<notifications@github.com> wrote: 

我又测试了voc格式的单类别红细胞数据集,用您修改后的配置文件训练map为76.5%,但是snn的评估mAP只有56.50%,搞不太清楚为啥,感觉我错的地方差不多

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

cwq159 commented 3 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

I can’t find it now, but I didn’t change any hip-para in the source code. you can train it for 300 epochs or more.

                            cwq

                                ***@***.***

    签名由
    网易邮箱大师
    定制

On 04/19/2021 ***@***.***> wrote: 

could you share the weight after training? use cfg/yolov3-tiny-mp2conv-mp1none-lk2relu-up2tconv.cfg, i can not reach 38.70% map

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

buaa-luzhi commented 2 years ago

@HeuristicLU 您好! 请问一下, (1) The stage of training: python3 train.py --batch-size 32 --cfg cfg/yolov3-tiny-mp2conv-mp1none-lk2relu-up2tconv.cfg --data data/coco.data --weights '' (2)Transform python3 ann_to_snn.py --cfg cfg/yolov3-tiny-mp2conv-mp1none-lk2relu-up2tconv.cfg --data data/coco.data --weights weights/best.pt --timesteps 128 我这样训练对吗?一直报ValueError: ('cannot find tensor Size', torch.Size([16, 16, 640, 640]))这个错误,换了好多版本,都没解决。 希望您有时间回复一下,谢谢!

Agent-QG commented 2 years ago

@HeuristicLU 您好,我在使用ann_to_snn.py后如何看转换后的map呢,需要使用生成的yolov3-tiny-ours-snn.weights重新训练一遍数据集吗?因为如果我用新weights训练的话会报错 WARNING: non-finite loss, ending training tensor([nan, nan, nan, nan], device='cuda:0') 希望您能回复一下,感谢