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

Chapter7: Training R-CNN Notebook #71

Open
MuhammedM294 opened this issue Jul 23, 2023 · 0 comments
Open

Chapter7: Training R-CNN Notebook #71

MuhammedM294 opened this issue Jul 23, 2023 · 0 comments

Comments

@MuhammedM294
Copy link

There is a missing parameter (epsilon) when calculating the IOUs of all candidates using extract_iou function (code line 8).

                  for ix, (im, bbs, labels, fpath) in enumerate(ds):
                      if(ix==N):
                          break
                      H, W, _ = im.shape
                      candidates = extract_candidates(im)
                      candidates = np.array([(x,y,x+w,y+h) for x,y,w,h in candidates])
                      ious, rois, clss, deltas = [], [], [], []
                      ious = np.array([[extract_iou(candidate, _bb_) for candidate in candidates] for _bb_ in bbs]).T
                      for jx, candidate in enumerate(candidates):
                          cx,cy,cX,cY = candidate
                          candidate_ious = ious[jx]
                          best_iou_at = np.argmax(candidate_ious)
                          best_iou = candidate_ious[best_iou_at]
                          best_bb = _x,_y,_X,_Y = bbs[best_iou_at]
                          if best_iou > 0.3: clss.append(labels[best_iou_at])
                          else : clss.append('background')
                          delta = np.array([_x-cx, _y-cy, _X-cX, _Y-cY]) / np.array([W,H,W,H])
                          deltas.append(delta)
                          rois.append(candidate / np.array([W,H,W,H]))
                      FPATHS.append(fpath)
                      IOUS.append(ious)
                      ROIS.append(rois)
                      CLSS.append(clss)
                      DELTAS.append(deltas)
                      GTBBS.append(bbs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant