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
207 stars 58 forks source link

内存开销问题 #30

Open 1y9y9l4 opened 3 years ago

1y9y9l4 commented 3 years ago

你好, 非常感谢你的源码,解决了我对Spiking YOLO的很多疑惑。 但我在运行ann_to_snn.py的过程中遇到了内存开销过高的问题,导致device='cpu'时内存占用将近80G,而无法在GPU上运行。 我发现在调用例如: https://github.com/cwq159/PyTorch-Spiking-YOLOv3/blob/941c3faddc2ecc6ab02086a5f50b46732ee0894d/spiking_utils/snn_transformer.py#L94 内存/显存开销不断增长,并且不会释放。 同样的问题出现在了: https://github.com/cwq159/PyTorch-Spiking-YOLOv3/blob/941c3faddc2ecc6ab02086a5f50b46732ee0894d/ann_to_snn.py#L183 我尝试过添加torch.cuda.empty_cache(),没有取得效果。请问这是否存在了某些内存/显存泄露问题? (FYI:所用到pytorch=1.3.0,cudatoolkit=10.1)

cwq159 commented 3 years ago

由于batch_size * timesteps比较大,确实会导致内存开销非常大,如果内存hold不住,可以尝试调小这两个参数。

buaa-luzhi commented 2 years ago

@1y9y9l4 Hello, sorry to bother you, but I wonder where Pytorch=1.3 was downloaded from. Thanks so much!

1y9y9l4 commented 2 years ago

I downloaded from anaconda. conda install pytorch=1.3