motokimura / yolo_v1_pytorch Goto Github PK
View Code? Open in Web Editor NEWPyTorch implementation of YOLO-v1 including training
License: MIT License
PyTorch implementation of YOLO-v1 including training
License: MIT License
@motokimura, I have trained this network and during training I found out that the size of weights are so big. Do you remember what was the weight size of your model? Mine is 1.1Gb
pred_xyxy[:, :2] = pred[:, 2]/float(S) - 0.5 * pred[:, 2:4]
pred_xyxy[:, 2:4] = pred[:, 2]/float(S) + 0.5 * pred[:, 2:4]
should be changed to
pred_xyxy[:, :2] = pred[:, :2]/float(S) - 0.5 * pred[:, 2:4]
pred_xyxy[:, 2:4] = pred[:, :2]/float(S) + 0.5 * pred[:, 2:4]
and also for target_xyxy
def compute_iou(self,bbox1,bbox2):
# 获取box1的第一个维度
N = bbox1.size(0)
# 获取box2的第一个维度
M = bbox2.size(0)
# Compute left-top coordinate of the intersections
#
lt = torch.max(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:,:2].unsqueeze(1).expand(N,M,2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:,:2].unsqueeze(0).expand(N,M,2)
)
rb = torch.min(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:, 2:].unsqueeze(1).expand(N, M, 2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:, 2:].unsqueeze(0).expand(N, M, 2)
)
pass
after torch.max(bbox1,bbox2),the point may be right top instead of left top
after torch.min(bbox1,bbox2),the point may be left bottom instead of right bottom
In voc.py
module (l. 120) you normalize coordinates such as :
xy, wh, label = boxes_xy[b], boxes_wh[b], int(labels[b])
ij = (xy / cell_size).ceil() - 1.0
i, j = int(ij[0]), int(ij[1]) # y & x index which represents its location on the grid.
x0y0 = ij * cell_size # x & y of the cell left-top corner.
xy_normalized = (xy - x0y0) / cell_size # x & y of the box on the cell, normalized from 0.0 to 1.0.
Predicted coordinates will converge to a such normalize form. So, why do you rescale your pred_xyxy
in that way in the loss.py
module (l. 114) ?
pred_xyxy = Variable(torch.FloatTensor(pred.size())) # [B, 5=len([x1, y1, x2, y2, conf])]
# Because (center_x,center_y)=pred[:, 2] and (w,h)=pred[:,2:4] are normalized for cell-size and image-size respectively,
# rescale (center_x,center_y) for the image-size to compute IoU correctly.
pred_xyxy[:, :2] = pred[:, :2]/float(S) - 0.5 * pred[:, 2:4]
pred_xyxy[:, 2:4] = pred[:, :2]/float(S) + 0.5 * pred[:, 2:4]
If I understand correctly this block, you normalized by S
your grid number (here, 7 I suppose) a value which is already normalized in a certain form (normalized by the grid cell here). Can't that be an issue ?
As stated in the title.
Hi, motokimura,
I'm sorry, I have to ask you again, the question is about Maxpool Layer in darknet.py file of "_make_conv_layers", is about "nn.MaxPool2d(2)", the function nn.MaxPool2d(2), you didn't use the "stride" parameter, but the author paper has to stride, so i have confusion, could you give a more explain?
thank you very much!
in voc.py
def random_scale(self, img, boxes):
WHY
img = cv2.resize(img, dsize=(int(w * scale), h), interpolation=cv2.INTER_LINEAR)
I suggest
img = cv2.resize(img, dsize=(int(w * scale), int(h * scale)), interpolation=cv2.INTER_LINEAR)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.