Open VOGGD opened 2 months ago
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
另外代码结构简单,很容易自己将代码完全看懂。可以尝试阅读全部代码 In addition, the code structure is simple, making it easy for oneself to fully understand the code. You can try reading the entire code
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
另外代码结构简单,很容易自己将代码完全看懂。可以尝试阅读全部代码 In addition, the code structure is simple, making it easy for oneself to fully understand the code. You can try reading the entire code
Thanks to the author's reply above, the code is working. I would like to know in the article “This hybrid coding approach enhances the overall performance of the network by compensating for information that may be lost during the time coding process through the direct coding part”, is this hybrid coding approach also applicable to fully connected network without any convolutional layer and the coding method is unchanged. Will it be more accurate than before combining under fully connected networks?
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
另外代码结构简单,很容易自己将代码完全看懂。可以尝试阅读全部代码 In addition, the code structure is simple, making it easy for oneself to fully understand the code. You can try reading the entire code
Thanks to the author's reply above, the code is working. I would like to know in the article “This hybrid coding approach enhances the overall performance of the network by compensating for information that may be lost during the time coding process through the direct coding part”, is this hybrid coding approach also applicable to fully connected network without any convolutional layer and the coding method is unchanged. Will it be more accurate than before combining under fully connected networks?
没有做过相应的实验,但他应当是有效的,我在spikingfomer,spiking resnet.spiking lenet,and spiking yolov5同过实验证明该混合编码方案是有效的。 I haven't conducted any corresponding experiments, but it should be effective. I have conducted experiments on Spiking Fomer, Spiking Resnet, Spiking Lenet, and Spiking YOLOv5 to prove that this hybrid encoding scheme is effective. 另外,时间编码时可以直接均分,就像是你截图里的操作,也可以先经过SIGMOID和LAYERNORM再进行均分,如下所示 In addition, when encoding time, it can be divided equally directly, just like the operation in your screenshot, or it can be divided equally after SIGMOID and LAYERNORM, as shown below 需要自己尝试哪一种效果更好一点,这在不同网络上表现有差异(差异不大), You need to try which one works better on your own, as there may be slight differences in performance across different networks,
sigmoid = nn.Sigmoid()
lano = nn.LayerNorm(normalized_shape=[3, imgs.size(2), imgs.size(3)]).to(imgs.device)
#At this time of 15 time steps
imgscopy=imgs
n14 = [0.8145714285714412, 0.7472428571428692, 0.6929142857142959, 0.6429857142857222, 0.596157142857148,
0.5513285714285736, 0.5053999999999994, 0.4598714285714251, 0.41354285714285094, 0.3656142857142769,
0.3142857142857033, 0.2575571428571302, 0.18842857142856598, 0.0]
lis = []
imgs = lano(imgs)
imgs = sigmoid(imgs)
for i in range(timestep-1):
# z = (i + 1.0)
# z = 1. - z / (timestep-1)
# z = z.__float__()
x = torch.where(imgs > n14[i], 1., 0)
imgs -= imgs * x
lis.append(x)
lis=torch.stack(lis)
x=torch.cat([imgscopy.unsqueeze(0),lis],0).flatten(0, 1)
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
另外代码结构简单,很容易自己将代码完全看懂。可以尝试阅读全部代码 In addition, the code structure is simple, making it easy for oneself to fully understand the code. You can try reading the entire code
Thanks to the author's reply above, the code is working. I would like to know in the article “This hybrid coding approach enhances the overall performance of the network by compensating for information that may be lost during the time coding process through the direct coding part”, is this hybrid coding approach also applicable to fully connected network without any convolutional layer and the coding method is unchanged. Will it be more accurate than before combining under fully connected networks?
没有做过相应的实验,但他应当是有效的,我在spikingfomer,spiking resnet.spiking lenet,and spiking yolov5同过实验证明该混合编码方案是有效的。 I haven't conducted any corresponding experiments, but it should be effective. I have conducted experiments on Spiking Fomer, Spiking Resnet, Spiking Lenet, and Spiking YOLOv5 to prove that this hybrid encoding scheme is effective. 另外,时间编码时可以直接均分,就像是你截图里的操作,也可以先经过SIGMOID和LAYERNORM再进行均分,如下所示 In addition, when encoding time, it can be divided equally directly, just like the operation in your screenshot, or it can be divided equally after SIGMOID and LAYERNORM, as shown below 需要自己尝试哪一种效果更好一点,这在不同网络上表现有差异(差异不大), You need to try which one works better on your own, as there may be slight differences in performance across different networks,
sigmoid = nn.Sigmoid() lano = nn.LayerNorm(normalized_shape=[3, imgs.size(2), imgs.size(3)]).to(imgs.device) #At this time of 15 time steps imgscopy=imgs n14 = [0.8145714285714412, 0.7472428571428692, 0.6929142857142959, 0.6429857142857222, 0.596157142857148, 0.5513285714285736, 0.5053999999999994, 0.4598714285714251, 0.41354285714285094, 0.3656142857142769, 0.3142857142857033, 0.2575571428571302, 0.18842857142856598, 0.0] lis = [] imgs = lano(imgs) imgs = sigmoid(imgs) for i in range(timestep-1): # z = (i + 1.0) # z = 1. - z / (timestep-1) # z = z.__float__() x = torch.where(imgs > n14[i], 1., 0) imgs -= imgs * x lis.append(x) lis=torch.stack(lis) x=torch.cat([imgscopy.unsqueeze(0),lis],0).flatten(0, 1)
Thanks to the author's reply, I have tested hybrid coding on a two layer fully connected network. The coding is shown below. The training method, back propagation method, trainable parameters and other settings of the whole network are consistent with the code you provided. After testing, I found that the accuracy of the hybrid coding network doesn't seem to improve much compared to single coding, and is almost the same as the highest accuracy of single coding. I tried to find out the problem but did not solve it, can the author help me to answer this doubt?
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
另外代码结构简单,很容易自己将代码完全看懂。可以尝试阅读全部代码 In addition, the code structure is simple, making it easy for oneself to fully understand the code. You can try reading the entire code
Thanks to the author's reply above, the code is working. I would like to know in the article “This hybrid coding approach enhances the overall performance of the network by compensating for information that may be lost during the time coding process through the direct coding part”, is this hybrid coding approach also applicable to fully connected network without any convolutional layer and the coding method is unchanged. Will it be more accurate than before combining under fully connected networks?
没有做过相应的实验,但他应当是有效的,我在spikingfomer,spiking resnet.spiking lenet,and spiking yolov5同过实验证明该混合编码方案是有效的。 I haven't conducted any corresponding experiments, but it should be effective. I have conducted experiments on Spiking Fomer, Spiking Resnet, Spiking Lenet, and Spiking YOLOv5 to prove that this hybrid encoding scheme is effective. 另外,时间编码时可以直接均分,就像是你截图里的操作,也可以先经过SIGMOID和LAYERNORM再进行均分,如下所示 In addition, when encoding time, it can be divided equally directly, just like the operation in your screenshot, or it can be divided equally after SIGMOID and LAYERNORM, as shown below 需要自己尝试哪一种效果更好一点,这在不同网络上表现有差异(差异不大), You need to try which one works better on your own, as there may be slight differences in performance across different networks,
sigmoid = nn.Sigmoid() lano = nn.LayerNorm(normalized_shape=[3, imgs.size(2), imgs.size(3)]).to(imgs.device) #At this time of 15 time steps imgscopy=imgs n14 = [0.8145714285714412, 0.7472428571428692, 0.6929142857142959, 0.6429857142857222, 0.596157142857148, 0.5513285714285736, 0.5053999999999994, 0.4598714285714251, 0.41354285714285094, 0.3656142857142769, 0.3142857142857033, 0.2575571428571302, 0.18842857142856598, 0.0] lis = [] imgs = lano(imgs) imgs = sigmoid(imgs) for i in range(timestep-1): # z = (i + 1.0) # z = 1. - z / (timestep-1) # z = z.__float__() x = torch.where(imgs > n14[i], 1., 0) imgs -= imgs * x lis.append(x) lis=torch.stack(lis) x=torch.cat([imgscopy.unsqueeze(0),lis],0).flatten(0, 1)
Thanks to the author's reply, I have tested hybrid coding on a two layer fully connected network. The coding is shown below. The training method, back propagation method, trainable parameters and other settings of the whole network are consistent with the code you provided. After testing, I found that the accuracy of the hybrid coding network doesn't seem to improve much compared to single coding, and is almost the same as the highest accuracy of single coding. I tried to find out the problem but did not solve it, can the author help me to answer this doubt?
我不太确定你的两层网络是什么样子,以及你具体和什么编码方式进行对比。但是他在浅层网络,较低时间步没有明显提升可能是正常情况。 另外文章里说到在较高时间步混合编码接近时间编码。在较低时间步混合编码接近直接编码。 但在低时间步步强于时间编码,高时间步强于直接编码。 你可以尝试增加时间步在10或15时间步以上。(要使用本文提供的神经元模型,与网络输出权重) I'm not quite sure what your two-layer network looks like or what encoding method you're comparing it to. But it may be normal for him to have no significant improvement at lower time steps in shallow networks. In addition, the article mentions that mixed encoding is close to time encoding at higher time steps. Hybrid encoding approaches direct encoding at lower time steps. But in low time steps, it is stronger than time encoding, and in high time steps, it is stronger than direct encoding. You can try increasing the time step by 10 or 15 time steps or more. (To use the neuron model provided in this article, along with the network output weights)
Hi author, can you tell me why I get this error: AttributeError: 'Spike' object has no attribute 're'. How do I go about fixing it?
你有可以私信联系的方法吗。可以更快一些,比如邮箱什么的
Do you have a way to contact me via private message. It can be faster, such as email or something like that
直接将132行至135行的报错行删掉就行。Just delete the error lines from 132 to 135 directly. a = [["{:.4f}".format(nu) for nu in num] for num in spike.re.tolist()]
是因为你将在lenet_spiking文件中62行的self.re=nn.Parameter(torch.ones([self.layers,self.num_steps]) )注释或删除掉才会出现以上错误,不过这一行确实没有作用。 The above error occurred because you commented on or deleted line 62 of the 'self.re=nn.Parameter(torch.ones([self.layers,self.num_steps]) )' in the lenet_spiking file,but this line does not have any effect.