user3789200
user3789200

Reputation: 1186

VGG transfer learning error

I'm training a VGG network using transfer learning approach. (fine-tuning) But while training the dataset, I found the following error where it stops the training process.

ETA: 19:00:06
  4407296/553467096 [..............................] - ETA: 19:06:49
  4415488/553467096 [..............................] - ETA: 19:10:23Traceback (most recent call last):
  File "C:\CT_SCAN_IMAGE_SET\vgg\vggTransferLearning.py", line 161, in <module>
    model = vgg16_model(img_rows, img_cols, channel, num_classes)
  File "C:\CT_SCAN_IMAGE_SET\vgg\vggTransferLearning.py", line 120, in vgg16_model
    model = VGG16(weights='imagenet', include_top=True)
  File "C:\Research\Python_installation\lib\site-packages\keras\applications\vgg16.py", line 169, in VGG16
    file_hash='64373286793e3c8b2b4e3219cbf3544b')
  File "C:\Research\Python_installation\lib\site-packages\keras\utils\data_utils.py", line 221, in get_file
    urlretrieve(origin, fpath, dl_progress)
  File "C:\Research\Python_installation\lib\urllib\request.py", line 217, in urlretrieve
    block = fp.read(bs)
  File "C:\Research\Python_installation\lib\http\client.py", line 448, in read
    n = self.readinto(b)
  File "C:\Research\Python_installation\lib\http\client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "C:\Research\Python_installation\lib\socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "C:\Research\Python_installation\lib\ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Research\Python_installation\lib\ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "C:\Research\Python_installation\lib\ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Can someone please help me to identify the issue here.

Upvotes: 0

Views: 550

Answers (1)

Monil shah
Monil shah

Reputation: 54

When it's trying to download the weights of vgg16, the error is shown due to connection break. Try to download weights manually. (link: https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5)

Once the weights are downloaded put it in the folder called 'models' which is in keras folder. keras folder will be hidden by default.

PathToFolder: C:\Users\UserName.keras\models.

After this setup, try to run the code.

Upvotes: 1

Related Questions