Tencent / FaceDetection-DSFD

腾讯优图高精度双分支人脸检测器

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix RuntimeError: Legacy autograd function with non-static forward method is deprecated

OceanWong1991 opened this issue · comments

change face_ssd.py line 345 to:

         # output = self.detect(
               #   face_loc.view(face_loc.size(0), -1, 4),         # loc preds
               #   self.softmax(face_conf.view(face_conf.size(0), -1, self.num_classes)), # conf preds
               #   self.priors.type(type(x.data))                  # default boxes
               # )

               ###########################################################修改代码################################################################
               # Detect类不支持静态方法的前向传播,因此使用类直接调用方法
               output = self.detect.forward(face_loc.view(face_loc.size(0), -1, 4),
                                            self.softmax(face_conf.view(face_conf.size(0), -1, self.num_classes)),
                                            self.priors.type(type(x.data)))
               ###########################################################修改代码################################################################