Home > other >  Pytorch code for help
Pytorch code for help

Time:09-23

The problems in the process of reading the code, there is a piece of code in DCFnet target tracking algorithm, the feeling is very confused ~

class DCFNet (nn Module) :
Def __init__ (self, config=None) :
Super (DCFNet, self) __init__ ()
The self feature=DCFNetFeature ()

self. Yf=config. Yf. Clone ()
Self. Lambda0=config. Lambda0


def forward (self, z, x) :
Z=self. Feature (z)
X=self. Feature (x)
Zf=torch. RFFT (z, signal_ndim=2)
Xf=torch. RFFT (x, signal_ndim=2)

KZZF=torch. The sum (torch. The sum (zf * * 2, dim=4, keepdim=True), dim=1, keepdim=True)
KXZF=torch. The sum (complex_mulconj (xf, zf), dim=1, keepdim=True)
Alphaf=self. Yf. To (device=z.d evice)/(KZZF +
self. Lambda0 # very Ugly
The response=torch. Irfft (complex_mul (KXZF, alphaf), signal_ndim=2)

return response

The focus is on two lines, there seems to be no any assignment and computing, and USES the method below, feeling completely pointless, asked the great spirit to be solved

CodePudding user response:

Alphaf=self. Yf. To (device=z.d evice)/(KZZF + self. Lambda0) # very Ugly

Here is to use!

Self. Yf. To (device=z.d evice)=equal to the self. # yf () can understand

Self. Lambda0 this is specific see config. Lambda0 inside
  • Related