Faster-rcnn.pytorch: Error when training custom dataset

Created on 20 Mar 2019  路  3Comments  路  Source: jwyang/faster-rcnn.pytorch

I am trying to train a face detection network using WIDER Face dataset with vgg16 and pretrained model.

I am getting the following error. Any help on fixing this would be really helpful.

File "trainval_net.py", line 316, in
im_data.data.resize_(data[0].size()).copy_(data[0])
RuntimeError: set_sizes_contiguous is not allowed on Tensor created from .data or .detach()

using the code from here
https://github.com/haleuh/face-faster-rcnn.pytorch

Most helpful comment

please replace: im_data.data.resize_(data[0].size()).copy_(data[0]) with im_data.resize_(data[0].size()).copy_(data[0]), because according with pytorch#15070: pythorch version 1.1 use the allow_tensor_metada_change_ flag, so make change with derived tensor is illegal. details see: pytorch#15070

All 3 comments

please replace: im_data.data.resize_(data[0].size()).copy_(data[0]) with im_data.resize_(data[0].size()).copy_(data[0]), because according with pytorch#15070: pythorch version 1.1 use the allow_tensor_metada_change_ flag, so make change with derived tensor is illegal. details see: pytorch#15070

This worked thanks!

@xitianshan Sir,should I replace other code which use xx.data.resize_() like im_data.data.resize_()?Cause as following code:(faster-rcnn.pytorch/trainval_net.py)
other values also use xx.data.resize()function.

  im_data.data.resize_(data[0].size()).copy_(data[0])
  im_info.data.resize_(data[1].size()).copy_(data[1])
  gt_boxes.data.resize_(data[2].size()).copy_(data[2])
  num_boxes.data.resize_(data[3].size()).copy_(data[3])
Was this page helpful?
0 / 5 - 0 ratings