-
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Closed
Labels
StaleStale and schedule for closing soonStale and schedule for closing soonquestionFurther information is requestedFurther information is requested
Description
❔Question
Hi,
I want to figure out the intuition of bbox detection.
In yolov3, we can find that the output can be write by these:


So, in yolov5,
I look into the src code:
Lines 21 to 38 in 1e95337
| def forward(self, x): | |
| # x = x.copy() # for profiling | |
| z = [] # inference output | |
| self.training |= self.export | |
| for i in range(self.nl): | |
| bs, _, ny, nx = x[i].shape # x(bs,255,20,20) to x(bs,3,20,20,85) | |
| x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous() | |
| if not self.training: # inference | |
| if self.grid[i].shape[2:4] != x[i].shape[2:4]: | |
| self.grid[i] = self._make_grid(nx, ny).to(x[i].device) | |
| y = x[i].sigmoid() | |
| y[..., 0:2] = (y[..., 0:2] * 2. - 0.5 + self.grid[i].to(x[i].device)) * self.stride[i] # xy | |
| y[..., 2:4] = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i] # wh | |
| z.append(y.view(bs, -1, self.no)) | |
| return x if self.training else (torch.cat(z, 1), x) |
And try to formularize it:
Am I right?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
StaleStale and schedule for closing soonStale and schedule for closing soonquestionFurther information is requestedFurther information is requested