torchcv icon indicating copy to clipboard operation
torchcv copied to clipboard

evaluation

Open nationalflag opened this issue 8 years ago • 8 comments

The batchsize of eval.py must be 1?

nationalflag avatar Mar 08 '18 03:03 nationalflag

Same problem, trying to solve with larger batch size.

zmonoid avatar May 22 '18 09:05 zmonoid

@zmonoid would you mind sharing your solution?

Jumabek avatar May 31 '18 08:05 Jumabek

@Jumabek Yes, basically, it is like:

for i, (inputs, box_targets, label_targets) in enumerate(dataloader):
        print('%d/%d' % (i, len(dataloader)))
        loc_preds, cls_preds = net(Variable(inputs.cuda(), volatile=True))


        for j in range(inputs.size(0)):
        	gt_boxes.append(box_targets[j])
        	gt_labels.append(label_targets[j])
	        box_preds, label_preds, score_preds = box_coder.decode(
	            loc_preds[j].cpu().data.squeeze(),
	            F.softmax(cls_preds[j].squeeze(), dim=1).cpu().data,
	            score_thresh=0.01)

	        pred_boxes.append(box_preds)
        	pred_labels.append(label_preds)
        	pred_scores.append(score_preds)

Still it is very slow. Main time consumption is at box_coder.decode.

zmonoid avatar May 31 '18 10:05 zmonoid

Thanks I changed box decoding to gpu and got improvement from 17sec to 7 sec for single image

On Thu, May 31, 2018, 7:13 PM ZHOU Bin [email protected] wrote:

@Jumabek https://github.com/Jumabek Yes, basically, it is like:

for i, (inputs, box_targets, label_targets) in enumerate(dataloader): print('%d/%d' % (i, len(dataloader))) loc_preds, cls_preds = net(Variable(inputs.cuda(), volatile=True))

    for j in range(inputs.size(0)):
    	gt_boxes.append(box_targets[j])
    	gt_labels.append(label_targets[j])
      box_preds, label_preds, score_preds = box_coder.decode(
          loc_preds[j].cpu().data.squeeze(),
          F.softmax(cls_preds[j].squeeze(), dim=1).cpu().data,
          score_thresh=0.01)

      pred_boxes.append(box_preds)
    	pred_labels.append(label_preds)
    	pred_scores.append(score_preds)

Still it is very slow. Main time consumption is at box_coder.decode.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kuangliu/torchcv/issues/14#issuecomment-393483892, or mute the thread https://github.com/notifications/unsubscribe-auth/AEJIQa62FDSz19b0CcDjiyOOju7re_psks5t38ItgaJpZM4SiGcI .

Jumabek avatar May 31 '18 10:05 Jumabek

you might find https://github.com/kuangliu/torchcv/issues/29 informative

Jumabek avatar Jun 05 '18 01:06 Jumabek

Speed is a lot faster when I am evaluating later models like after 300K iter

Jumabek avatar Jun 07 '18 05:06 Jumabek

@Jumabek can u share the gpu implementation? I'm always getting this: RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for argument #2 'other' Is this because my other variables are in CPU? Update: Figured it out. But still is very slow

vaishnavm217 avatar Jun 18 '18 13:06 vaishnavm217

Why is the score threshold kept very low?? The VOC function needs all the generated boxes? The decoding is very fast when the threshold is high

vaishnavm217 avatar Jun 20 '18 06:06 vaishnavm217