Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Darknet() class: forward pass yolo case #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,10 @@ def get_module_list(self):


def forward(self, x, CUDA):
detections = []
modules = self.blocks[1:]
outputs = {} #We cache the outputs for the route layer
detections = torch.empty(0) # concatenate all bbox predictions to this initially empty tensor


write = 0
for i in range(len(modules)):

module_type = (modules[i]["type"])
Expand Down Expand Up @@ -364,17 +362,7 @@ def forward(self, x, CUDA):
if type(x) == int:
continue


if not write:
detections = x
write = 1

else:
detections = torch.cat((detections, x), 1)

outputs[i] = outputs[i-1]


detections = torch.cat((detections, x), dim=1)

try:
return detections
Expand Down