Code Monkey home page Code Monkey logo

yolo_v1_pytorch's Introduction

YOLO-v1 Pytorch

Pytorch re-implementation of YOLO-v1.

This README is under construction...

Results

Some detection examples on PASCAL VOC 2007 test data.

yolo_v1_pytorch's People

Contributors

dependabot[bot] avatar motokimura avatar nuka137 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yolo_v1_pytorch's Issues

maxpool layer

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?

Uploading image.png…

thank you very much!

full connect

hi, motokimura,
i have a question about "_make_fc_layers" in "darknet.py", the yolo author is training darknet in Imagenet, the data classes is about 1000, but we are training in voc data set, the classes is about 20, so, the below picture red box wether change to 20?
image

randomg scaling question..

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)

Weight size is huge?

@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

  • What was the mAP?

little bug about loss.py

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

couldn't load

hi, when I run your code, I counter the problem, as follows the show, could you give me help?:
image

the error of compute_iou in loss.py

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

Is there a problem in the coordinates normalization before computing IoU ?

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.