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

What should I change in your 'network' if I want to test the performance of your model on the other dataset? #9

Open
magemoumou opened this issue Jun 11, 2019 · 1 comment

Comments

@magemoumou
Copy link

What should I change in your 'network' if I want to test the performance of your model on the other dataset?
I looked through your network.forward() part, the code is as follow:

def forward(self, image, image_level_label ,im_info, gt_boxes=None, ss_boxes=None, mode='TRAIN'):
#print('forward ss_boxes ', ss_boxes.shape)
self._image_gt_summaries['image'] = image
self._image_gt_summaries['image_level_label'] = image_level_label
self._image_gt_summaries['gt_boxes'] = gt_boxes
self._image_gt_summaries['im_info'] = im_info
self._image_gt_summaries['ss_boxes'] = ss_boxes

self._image = torch.from_numpy(image.transpose([0,3,1,2]).copy()).to(self._device)
self._image_level_label = torch.from_numpy(image_level_label) if image_level_label is not None else None
self._im_info = im_info # No need to change; actually it can be an list
self._gt_boxes = torch.from_numpy(gt_boxes).to(self._device) if gt_boxes is not None else None

self._mode = mode

rois, cls_prob, det_prob, bbox_pred ,cls_det_prob_product ,det_cls_prob = self._predict(ss_boxes)

bbox_pred = bbox_pred[:,:80]

if mode == 'TEST':
  stds = bbox_pred.data.new(cfg.TRAIN.BBOX_NORMALIZE_STDS).repeat(self._num_classes).unsqueeze(0).expand_as(bbox_pred)
  means = bbox_pred.data.new(cfg.TRAIN.BBOX_NORMALIZE_MEANS).repeat(self._num_classes).unsqueeze(0).expand_as(bbox_pred)
  self._predictions["bbox_pred"] = bbox_pred.mul(stds).add(means)
else:
  self._add_losses() # compute losses

And I want to konw the meaning of the sentence "bbox_pred = bbox_pred[:,:80]".
What is the meaning of the number 80 in this sentence?
Does it have relationship with the "num_classes"?
For example, your model is tested on the dataset pascal voc2007, there are 20 object classes(without the 'background' class) in this dataset.
What if my dataset has only 8 object classes without 'background' ?

And expect for this part, is there any module in your code I need to change if I want to test the model on other dataset?

Look forward to your early reply.
Thanks for your patience.

@vasgaowei
Copy link
Owner

vasgaowei commented Jun 12, 2019

  1. My code is based on faster-rcnn. And "bbox_pred" in the faster rcnn code is the regression network's
    output for each proposal. And a proposal is represented by a tuple (center_x, center_y, w, h), and the
    bbox_pred is the corresponding deltas, (dx, dy, dw, dh). And for pascal_voc dataset, there are 20
    classes, so for a proposal, a bbox_pred should have length of 4 x 20 = 80.
  2. And if you want to test the model on other dataset, I think first should change the dataset's format into
    the pascal_voc's format. And train the model, and test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants