{
  "id": 299472,
  "title": "Help: Error when submitting notebook",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/299472",
  "author_name": "",
  "post_date": "2022-01-08T07:02:40.559551500Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>My notebook runs correctly with internet enabled. When I am submitting my notebook without internet  I get the following error:</p>\n<p>`---------------------------------------------------------------------------<br>\nOSError                                   Traceback (most recent call last)<br>\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)<br>\n     56     try:<br>\n---&gt; 57         return ImageFont.truetype(str(font) if font.exists() else font.name, size)<br>\n     58     except Exception as e:  # download if missing</p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in truetype(font, size, index, encoding, layout_engine)<br>\n    852     try:<br>\n--&gt; 853         return freetype(font)<br>\n    854     except OSError:</p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in freetype(font)<br>\n    849     def freetype(font):<br>\n--&gt; 850         return FreeTypeFont(font, size, index, encoding, layout_engine)<br>\n    851 </p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in <strong>init</strong>(self, font, size, index, encoding, layout_engine)<br>\n    209             self.font = core.getfont(<br>\n--&gt; 210                 font, size, index, encoding, layout_engine=layout_engine<br>\n    211             )</p>\n<p>OSError: cannot open resource</p>\n<p>During handling of the above exception, another exception occurred:</p>\n<p>gaierror                                  Traceback (most recent call last)<br>\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)<br>\n   1349                 h.request(req.get_method(), req.selector, req.data, headers,<br>\n-&gt; 1350                           encode_chunked=req.has_header('Transfer-encoding'))<br>\n   1351             except OSError as err: # timeout error</p>\n<p>/opt/conda/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)<br>\n   1280         \"\"\"Send a complete request to the server.\"\"\"<br>\n-&gt; 1281         self._send_request(method, url, body, headers, encode_chunked)<br>\n   1282 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)<br>\n   1326             body = _encode(body, 'body')<br>\n-&gt; 1327         self.endheaders(body, encode_chunked=encode_chunked)<br>\n   1328 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)<br>\n   1275             raise CannotSendHeader()<br>\n-&gt; 1276         self._send_output(message_body, encode_chunked=encode_chunked)<br>\n   1277 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)<br>\n   1035         del self._buffer[:]<br>\n-&gt; 1036         self.send(msg)<br>\n   1037 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in send(self, data)<br>\n    975             if self.auto_open:<br>\n--&gt; 976                 self.connect()<br>\n    977             else:</p>\n<p>/opt/conda/lib/python3.7/http/client.py in connect(self)<br>\n   1442 <br>\n-&gt; 1443             super().connect()<br>\n   1444 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in connect(self)<br>\n    947         self.sock = self._create_connection(<br>\n--&gt; 948             (self.host,self.port), self.timeout, self.source_address)<br>\n    949         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)</p>\n<p>/opt/conda/lib/python3.7/socket.py in create_connection(address, timeout, source_address)<br>\n    706     err = None<br>\n--&gt; 707     for res in getaddrinfo(host, port, 0, SOCK_STREAM):<br>\n    708         af, socktype, proto, canonname, sa = res</p>\n<p>/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)<br>\n    751     addrlist = []<br>\n--&gt; 752     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):<br>\n    753         af, socktype, proto, canonname, sa = res</p>\n<p>gaierror: [Errno -3] Temporary failure in name resolution</p>\n<p>During handling of the above exception, another exception occurred:</p>\n<p>URLError                                  Traceback (most recent call last)<br>\n/tmp/ipykernel_25/3942314954.py in <br>\n      1 CONF= 0.15<br>\n      2 IOU= 0.50<br>\n----&gt; 3 model = load_model(Best_Model, conf=CONF, iou=IOU)<br>\n      4 for idx, (img, pred_df) in enumerate(tqdm(iter_test)):<br>\n      5     bboxes, confs  = predict(model, img, size=IMG_SIZE, augment=True)</p>\n<p>/tmp/ipykernel_25/3261273385.py in load_model(Best_Model, conf, iou)<br>\n      4                            path=Best_Model,<br>\n      5                            source='local',<br>\n----&gt; 6                            force_reload=True)  # local repo<br>\n      7     model.conf = conf  # NMS confidence threshold<br>\n      8     model.iou  = iou  # NMS IoU threshold</p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)<br>\n    380         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)<br>\n    381 <br>\n--&gt; 382     model = _load_local(repo_or_dir, model, *args, **kwargs)<br>\n    383     return model<br>\n    384 </p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, *<em>kwargs)\n    409 \n    410     entry = _load_entry_from_hubconf(hub_module, model)\n--&gt; 411     model = entry(</em>args, **kwargs)<br>\n    412 <br>\n    413     sys.path.remove(hubconf_dir)</p>\n<p>/kaggle/working/yolov5/hubconf.py in custom(path, autoshape, verbose, device)<br>\n     68 def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):<br>\n     69     # YOLOv5 custom or local model<br>\n---&gt; 70     return _create(path, autoshape=autoshape, verbose=verbose, device=device)<br>\n     71 <br>\n     72 </p>\n<p>/kaggle/working/yolov5/hubconf.py in _create(name, pretrained, channels, classes, autoshape, verbose, device)<br>\n     29     from pathlib import Path<br>\n     30 <br>\n---&gt; 31     from models.common import AutoShape, DetectMultiBackend<br>\n     32     from models.yolo import Model<br>\n     33     from utils.downloads import attempt_download</p>\n<p>/kaggle/working/yolov5/models/common.py in <br>\n     25 from utils.general import (LOGGER, check_requirements, check_suffix, check_version, colorstr, increment_path,<br>\n     26                            make_divisible, non_max_suppression, scale_coords, xywh2xyxy, xyxy2xywh)<br>\n---&gt; 27 from utils.plots import Annotator, colors, save_one_box<br>\n     28 from utils.torch_utils import copy_attr, time_sync<br>\n     29 </p>\n<p>/kaggle/working/yolov5/utils/plots.py in <br>\n     66 <br>\n     67 <br>\n---&gt; 68 class Annotator:<br>\n     69     if RANK in (-1, 0):<br>\n     70         check_font()  # download TTF if necessary</p>\n<p>/kaggle/working/yolov5/utils/plots.py in Annotator()<br>\n     68 class Annotator:<br>\n     69     if RANK in (-1, 0):<br>\n---&gt; 70         check_font()  # download TTF if necessary<br>\n     71 <br>\n     72     # YOLOv5 Annotator for train/val mosaics and jpgs and detect/hub inference annotations</p>\n<p>/kaggle/working/yolov5/utils/plots.py in check_font(font, size)<br>\n     59         url = \"https://ultralytics.com/assets/\" + font.name<br>\n     60         print(f'Downloading {url} to {font}…')<br>\n---&gt; 61         torch.hub.download_url_to_file(url, str(font), progress=False)<br>\n     62         try:<br>\n     63             return ImageFont.truetype(str(font), size)</p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)<br>\n    435     # certificates in older Python<br>\n    436     req = Request(url, headers={\"User-Agent\": \"torch.hub\"})<br>\n--&gt; 437     u = urlopen(req)<br>\n    438     meta = u.info()<br>\n    439     if hasattr(meta, 'getheaders'):</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)<br>\n    220     else:<br>\n    221         opener = _opener<br>\n--&gt; 222     return opener.open(url, data, timeout)<br>\n    223 <br>\n    224 def install_opener(opener):</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)<br>\n    523             req = meth(req)<br>\n    524 <br>\n--&gt; 525         response = self._open(req, data)<br>\n    526 <br>\n    527         # post-process response</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in _open(self, req, data)<br>\n    541         protocol = req.type<br>\n    542         result = self._call_chain(self.handle_open, protocol, protocol +<br>\n--&gt; 543                                   '_open', req)<br>\n    544         if result:<br>\n    545             return result</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, <em>args)\n    501         for handler in handlers:\n    502             func = getattr(handler, meth_name)\n--&gt; 503             result = func(</em>args)<br>\n    504             if result is not None:<br>\n    505                 return result</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in https_open(self, req)<br>\n   1391         def https_open(self, req):<br>\n   1392             return self.do_open(http.client.HTTPSConnection, req,<br>\n-&gt; 1393                 context=self.<em>context, check_hostname=self._check_hostname)\n   1394 \n   1395         https_request = AbstractHTTPHandler.do_request</em></p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)<br>\n   1350                           encode_chunked=req.has_header('Transfer-encoding'))<br>\n   1351             except OSError as err: # timeout error<br>\n-&gt; 1352                 raise URLError(err)<br>\n   1353             r = h.getresponse()<br>\n   1354         except:</p>\n<p>URLError: `</p>",
  "messages": [
    {
      "id": "1642236",
      "postDate": "01/08/2022 07:02:40",
      "content": "<p>My notebook runs correctly with internet enabled. When I am submitting my notebook without internet  I get the following error:</p>\n<p>`---------------------------------------------------------------------------<br>\nOSError                                   Traceback (most recent call last)<br>\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)<br>\n     56     try:<br>\n---&gt; 57         return ImageFont.truetype(str(font) if font.exists() else font.name, size)<br>\n     58     except Exception as e:  # download if missing</p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in truetype(font, size, index, encoding, layout_engine)<br>\n    852     try:<br>\n--&gt; 853         return freetype(font)<br>\n    854     except OSError:</p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in freetype(font)<br>\n    849     def freetype(font):<br>\n--&gt; 850         return FreeTypeFont(font, size, index, encoding, layout_engine)<br>\n    851 </p>\n<p>/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in <strong>init</strong>(self, font, size, index, encoding, layout_engine)<br>\n    209             self.font = core.getfont(<br>\n--&gt; 210                 font, size, index, encoding, layout_engine=layout_engine<br>\n    211             )</p>\n<p>OSError: cannot open resource</p>\n<p>During handling of the above exception, another exception occurred:</p>\n<p>gaierror                                  Traceback (most recent call last)<br>\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)<br>\n   1349                 h.request(req.get_method(), req.selector, req.data, headers,<br>\n-&gt; 1350                           encode_chunked=req.has_header('Transfer-encoding'))<br>\n   1351             except OSError as err: # timeout error</p>\n<p>/opt/conda/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)<br>\n   1280         \"\"\"Send a complete request to the server.\"\"\"<br>\n-&gt; 1281         self._send_request(method, url, body, headers, encode_chunked)<br>\n   1282 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)<br>\n   1326             body = _encode(body, 'body')<br>\n-&gt; 1327         self.endheaders(body, encode_chunked=encode_chunked)<br>\n   1328 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)<br>\n   1275             raise CannotSendHeader()<br>\n-&gt; 1276         self._send_output(message_body, encode_chunked=encode_chunked)<br>\n   1277 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)<br>\n   1035         del self._buffer[:]<br>\n-&gt; 1036         self.send(msg)<br>\n   1037 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in send(self, data)<br>\n    975             if self.auto_open:<br>\n--&gt; 976                 self.connect()<br>\n    977             else:</p>\n<p>/opt/conda/lib/python3.7/http/client.py in connect(self)<br>\n   1442 <br>\n-&gt; 1443             super().connect()<br>\n   1444 </p>\n<p>/opt/conda/lib/python3.7/http/client.py in connect(self)<br>\n    947         self.sock = self._create_connection(<br>\n--&gt; 948             (self.host,self.port), self.timeout, self.source_address)<br>\n    949         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)</p>\n<p>/opt/conda/lib/python3.7/socket.py in create_connection(address, timeout, source_address)<br>\n    706     err = None<br>\n--&gt; 707     for res in getaddrinfo(host, port, 0, SOCK_STREAM):<br>\n    708         af, socktype, proto, canonname, sa = res</p>\n<p>/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)<br>\n    751     addrlist = []<br>\n--&gt; 752     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):<br>\n    753         af, socktype, proto, canonname, sa = res</p>\n<p>gaierror: [Errno -3] Temporary failure in name resolution</p>\n<p>During handling of the above exception, another exception occurred:</p>\n<p>URLError                                  Traceback (most recent call last)<br>\n/tmp/ipykernel_25/3942314954.py in <br>\n      1 CONF= 0.15<br>\n      2 IOU= 0.50<br>\n----&gt; 3 model = load_model(Best_Model, conf=CONF, iou=IOU)<br>\n      4 for idx, (img, pred_df) in enumerate(tqdm(iter_test)):<br>\n      5     bboxes, confs  = predict(model, img, size=IMG_SIZE, augment=True)</p>\n<p>/tmp/ipykernel_25/3261273385.py in load_model(Best_Model, conf, iou)<br>\n      4                            path=Best_Model,<br>\n      5                            source='local',<br>\n----&gt; 6                            force_reload=True)  # local repo<br>\n      7     model.conf = conf  # NMS confidence threshold<br>\n      8     model.iou  = iou  # NMS IoU threshold</p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)<br>\n    380         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)<br>\n    381 <br>\n--&gt; 382     model = _load_local(repo_or_dir, model, *args, **kwargs)<br>\n    383     return model<br>\n    384 </p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, *<em>kwargs)\n    409 \n    410     entry = _load_entry_from_hubconf(hub_module, model)\n--&gt; 411     model = entry(</em>args, **kwargs)<br>\n    412 <br>\n    413     sys.path.remove(hubconf_dir)</p>\n<p>/kaggle/working/yolov5/hubconf.py in custom(path, autoshape, verbose, device)<br>\n     68 def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):<br>\n     69     # YOLOv5 custom or local model<br>\n---&gt; 70     return _create(path, autoshape=autoshape, verbose=verbose, device=device)<br>\n     71 <br>\n     72 </p>\n<p>/kaggle/working/yolov5/hubconf.py in _create(name, pretrained, channels, classes, autoshape, verbose, device)<br>\n     29     from pathlib import Path<br>\n     30 <br>\n---&gt; 31     from models.common import AutoShape, DetectMultiBackend<br>\n     32     from models.yolo import Model<br>\n     33     from utils.downloads import attempt_download</p>\n<p>/kaggle/working/yolov5/models/common.py in <br>\n     25 from utils.general import (LOGGER, check_requirements, check_suffix, check_version, colorstr, increment_path,<br>\n     26                            make_divisible, non_max_suppression, scale_coords, xywh2xyxy, xyxy2xywh)<br>\n---&gt; 27 from utils.plots import Annotator, colors, save_one_box<br>\n     28 from utils.torch_utils import copy_attr, time_sync<br>\n     29 </p>\n<p>/kaggle/working/yolov5/utils/plots.py in <br>\n     66 <br>\n     67 <br>\n---&gt; 68 class Annotator:<br>\n     69     if RANK in (-1, 0):<br>\n     70         check_font()  # download TTF if necessary</p>\n<p>/kaggle/working/yolov5/utils/plots.py in Annotator()<br>\n     68 class Annotator:<br>\n     69     if RANK in (-1, 0):<br>\n---&gt; 70         check_font()  # download TTF if necessary<br>\n     71 <br>\n     72     # YOLOv5 Annotator for train/val mosaics and jpgs and detect/hub inference annotations</p>\n<p>/kaggle/working/yolov5/utils/plots.py in check_font(font, size)<br>\n     59         url = \"https://ultralytics.com/assets/\" + font.name<br>\n     60         print(f'Downloading {url} to {font}…')<br>\n---&gt; 61         torch.hub.download_url_to_file(url, str(font), progress=False)<br>\n     62         try:<br>\n     63             return ImageFont.truetype(str(font), size)</p>\n<p>/opt/conda/lib/python3.7/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)<br>\n    435     # certificates in older Python<br>\n    436     req = Request(url, headers={\"User-Agent\": \"torch.hub\"})<br>\n--&gt; 437     u = urlopen(req)<br>\n    438     meta = u.info()<br>\n    439     if hasattr(meta, 'getheaders'):</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)<br>\n    220     else:<br>\n    221         opener = _opener<br>\n--&gt; 222     return opener.open(url, data, timeout)<br>\n    223 <br>\n    224 def install_opener(opener):</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)<br>\n    523             req = meth(req)<br>\n    524 <br>\n--&gt; 525         response = self._open(req, data)<br>\n    526 <br>\n    527         # post-process response</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in _open(self, req, data)<br>\n    541         protocol = req.type<br>\n    542         result = self._call_chain(self.handle_open, protocol, protocol +<br>\n--&gt; 543                                   '_open', req)<br>\n    544         if result:<br>\n    545             return result</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, <em>args)\n    501         for handler in handlers:\n    502             func = getattr(handler, meth_name)\n--&gt; 503             result = func(</em>args)<br>\n    504             if result is not None:<br>\n    505                 return result</p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in https_open(self, req)<br>\n   1391         def https_open(self, req):<br>\n   1392             return self.do_open(http.client.HTTPSConnection, req,<br>\n-&gt; 1393                 context=self.<em>context, check_hostname=self._check_hostname)\n   1394 \n   1395         https_request = AbstractHTTPHandler.do_request</em></p>\n<p>/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)<br>\n   1350                           encode_chunked=req.has_header('Transfer-encoding'))<br>\n   1351             except OSError as err: # timeout error<br>\n-&gt; 1352                 raise URLError(err)<br>\n   1353             r = h.getresponse()<br>\n   1354         except:</p>\n<p>URLError: `</p>",
      "rawMarkdown": "My notebook runs correctly with internet enabled. When I am submitting my notebook without internet  I get the following error:\n\n\n\n`---------------------------------------------------------------------------\nOSError                                   Traceback (most recent call last)\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)\n     56     try:\n---> 57         return ImageFont.truetype(str(font) if font.exists() else font.name, size)\n     58     except Exception as e:  # download if missing\n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in truetype(font, size, index, encoding, layout_engine)\n    852     try:\n--> 853         return freetype(font)\n    854     except OSError:\n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in freetype(font)\n    849     def freetype(font):\n--> 850         return FreeTypeFont(font, size, index, encoding, layout_engine)\n    851 \n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in __init__(self, font, size, index, encoding, layout_engine)\n    209             self.font = core.getfont(\n--> 210                 font, size, index, encoding, layout_engine=layout_engine\n    211             )\n\nOSError: cannot open resource\n\nDuring handling of the above exception, another exception occurred:\n\ngaierror                                  Traceback (most recent call last)\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)\n   1349                 h.request(req.get_method(), req.selector, req.data, headers,\n-> 1350                           encode_chunked=req.has_header('Transfer-encoding'))\n   1351             except OSError as err: # timeout error\n\n/opt/conda/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)\n   1280         \"\"\"Send a complete request to the server.\"\"\"\n-> 1281         self._send_request(method, url, body, headers, encode_chunked)\n   1282 \n\n/opt/conda/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)\n   1326             body = _encode(body, 'body')\n-> 1327         self.endheaders(body, encode_chunked=encode_chunked)\n   1328 \n\n/opt/conda/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)\n   1275             raise CannotSendHeader()\n-> 1276         self._send_output(message_body, encode_chunked=encode_chunked)\n   1277 \n\n/opt/conda/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)\n   1035         del self._buffer[:]\n-> 1036         self.send(msg)\n   1037 \n\n/opt/conda/lib/python3.7/http/client.py in send(self, data)\n    975             if self.auto_open:\n--> 976                 self.connect()\n    977             else:\n\n/opt/conda/lib/python3.7/http/client.py in connect(self)\n   1442 \n-> 1443             super().connect()\n   1444 \n\n/opt/conda/lib/python3.7/http/client.py in connect(self)\n    947         self.sock = self._create_connection(\n--> 948             (self.host,self.port), self.timeout, self.source_address)\n    949         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)\n\n/opt/conda/lib/python3.7/socket.py in create_connection(address, timeout, source_address)\n    706     err = None\n--> 707     for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n    708         af, socktype, proto, canonname, sa = res\n\n/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)\n    751     addrlist = []\n--> 752     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\n    753         af, socktype, proto, canonname, sa = res\n\ngaierror: [Errno -3] Temporary failure in name resolution\n\nDuring handling of the above exception, another exception occurred:\n\nURLError                                  Traceback (most recent call last)\n/tmp/ipykernel_25/3942314954.py in <module>\n      1 CONF= 0.15\n      2 IOU= 0.50\n----> 3 model = load_model(Best_Model, conf=CONF, iou=IOU)\n      4 for idx, (img, pred_df) in enumerate(tqdm(iter_test)):\n      5     bboxes, confs  = predict(model, img, size=IMG_SIZE, augment=True)\n\n/tmp/ipykernel_25/3261273385.py in load_model(Best_Model, conf, iou)\n      4                            path=Best_Model,\n      5                            source='local',\n----> 6                            force_reload=True)  # local repo\n      7     model.conf = conf  # NMS confidence threshold\n      8     model.iou  = iou  # NMS IoU threshold\n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)\n    380         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)\n    381 \n--> 382     model = _load_local(repo_or_dir, model, *args, **kwargs)\n    383     return model\n    384 \n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, **kwargs)\n    409 \n    410     entry = _load_entry_from_hubconf(hub_module, model)\n--> 411     model = entry(*args, **kwargs)\n    412 \n    413     sys.path.remove(hubconf_dir)\n\n/kaggle/working/yolov5/hubconf.py in custom(path, autoshape, verbose, device)\n     68 def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):\n     69     # YOLOv5 custom or local model\n---> 70     return _create(path, autoshape=autoshape, verbose=verbose, device=device)\n     71 \n     72 \n\n/kaggle/working/yolov5/hubconf.py in _create(name, pretrained, channels, classes, autoshape, verbose, device)\n     29     from pathlib import Path\n     30 \n---> 31     from models.common import AutoShape, DetectMultiBackend\n     32     from models.yolo import Model\n     33     from utils.downloads import attempt_download\n\n/kaggle/working/yolov5/models/common.py in <module>\n     25 from utils.general import (LOGGER, check_requirements, check_suffix, check_version, colorstr, increment_path,\n     26                            make_divisible, non_max_suppression, scale_coords, xywh2xyxy, xyxy2xywh)\n---> 27 from utils.plots import Annotator, colors, save_one_box\n     28 from utils.torch_utils import copy_attr, time_sync\n     29 \n\n/kaggle/working/yolov5/utils/plots.py in <module>\n     66 \n     67 \n---> 68 class Annotator:\n     69     if RANK in (-1, 0):\n     70         check_font()  # download TTF if necessary\n\n/kaggle/working/yolov5/utils/plots.py in Annotator()\n     68 class Annotator:\n     69     if RANK in (-1, 0):\n---> 70         check_font()  # download TTF if necessary\n     71 \n     72     # YOLOv5 Annotator for train/val mosaics and jpgs and detect/hub inference annotations\n\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)\n     59         url = \"https://ultralytics.com/assets/\" + font.name\n     60         print(f'Downloading {url} to {font}...')\n---> 61         torch.hub.download_url_to_file(url, str(font), progress=False)\n     62         try:\n     63             return ImageFont.truetype(str(font), size)\n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)\n    435     # certificates in older Python\n    436     req = Request(url, headers={\"User-Agent\": \"torch.hub\"})\n--> 437     u = urlopen(req)\n    438     meta = u.info()\n    439     if hasattr(meta, 'getheaders'):\n\n/opt/conda/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)\n    220     else:\n    221         opener = _opener\n--> 222     return opener.open(url, data, timeout)\n    223 \n    224 def install_opener(opener):\n\n/opt/conda/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)\n    523             req = meth(req)\n    524 \n--> 525         response = self._open(req, data)\n    526 \n    527         # post-process response\n\n/opt/conda/lib/python3.7/urllib/request.py in _open(self, req, data)\n    541         protocol = req.type\n    542         result = self._call_chain(self.handle_open, protocol, protocol +\n--> 543                                   '_open', req)\n    544         if result:\n    545             return result\n\n/opt/conda/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)\n    501         for handler in handlers:\n    502             func = getattr(handler, meth_name)\n--> 503             result = func(*args)\n    504             if result is not None:\n    505                 return result\n\n/opt/conda/lib/python3.7/urllib/request.py in https_open(self, req)\n   1391         def https_open(self, req):\n   1392             return self.do_open(http.client.HTTPSConnection, req,\n-> 1393                 context=self._context, check_hostname=self._check_hostname)\n   1394 \n   1395         https_request = AbstractHTTPHandler.do_request_\n\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)\n   1350                           encode_chunked=req.has_header('Transfer-encoding'))\n   1351             except OSError as err: # timeout error\n-> 1352                 raise URLError(err)\n   1353             r = h.getresponse()\n   1354         except:\n\nURLError: <urlopen error [Errno -3] Temporary failure in name resolution>`",
      "votes": null
    },
    {
      "id": "1642253",
      "postDate": "01/08/2022 07:40:04",
      "content": "<p>Hi, you have to add Arial.ttf to your repository and then</p>\n<pre><code>!mkdir -p /root/.config/Ultralytics\n!cp ../input/your_repository/Arial.ttf /root/.config/Ultralytics/\n</code></pre>",
      "rawMarkdown": "Hi, you have to add Arial.ttf to your repository and then\n\n\n```\n!mkdir -p /root/.config/Ultralytics\n!cp ../input/your_repository/Arial.ttf /root/.config/Ultralytics/\n```",
      "votes": null
    },
    {
      "id": "1642376",
      "postDate": "01/08/2022 10:02:12",
      "content": "<p>Thanks for your reply. I corrected my mistake and it works. I uploaded the Arial.tff in my dataset but did not properly create the Ultralytics folder in the root directory.</p>",
      "rawMarkdown": "Thanks for your reply. I corrected my mistake and it works. I uploaded the Arial.tff in my dataset but did not properly create the Ultralytics folder in the root directory.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1642253,
      "author_name": "lukaszborecki",
      "author_url": "",
      "post_date": "01/08/2022 07:40:04",
      "content": "<p>Hi, you have to add Arial.ttf to your repository and then</p>\n<pre><code>!mkdir -p /root/.config/Ultralytics\n!cp ../input/your_repository/Arial.ttf /root/.config/Ultralytics/\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1642376,
          "author_name": "ddanndt",
          "author_url": "",
          "post_date": "01/08/2022 10:02:12",
          "content": "<p>Thanks for your reply. I corrected my mistake and it works. I uploaded the Arial.tff in my dataset but did not properly create the Ultralytics folder in the root directory.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1642236": "My notebook runs correctly with internet enabled. When I am submitting my notebook without internet  I get the following error:\n\n\n\n`---------------------------------------------------------------------------\nOSError                                   Traceback (most recent call last)\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)\n     56     try:\n---> 57         return ImageFont.truetype(str(font) if font.exists() else font.name, size)\n     58     except Exception as e:  # download if missing\n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in truetype(font, size, index, encoding, layout_engine)\n    852     try:\n--> 853         return freetype(font)\n    854     except OSError:\n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in freetype(font)\n    849     def freetype(font):\n--> 850         return FreeTypeFont(font, size, index, encoding, layout_engine)\n    851 \n\n/opt/conda/lib/python3.7/site-packages/PIL/ImageFont.py in __init__(self, font, size, index, encoding, layout_engine)\n    209             self.font = core.getfont(\n--> 210                 font, size, index, encoding, layout_engine=layout_engine\n    211             )\n\nOSError: cannot open resource\n\nDuring handling of the above exception, another exception occurred:\n\ngaierror                                  Traceback (most recent call last)\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)\n   1349                 h.request(req.get_method(), req.selector, req.data, headers,\n-> 1350                           encode_chunked=req.has_header('Transfer-encoding'))\n   1351             except OSError as err: # timeout error\n\n/opt/conda/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)\n   1280         \"\"\"Send a complete request to the server.\"\"\"\n-> 1281         self._send_request(method, url, body, headers, encode_chunked)\n   1282 \n\n/opt/conda/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)\n   1326             body = _encode(body, 'body')\n-> 1327         self.endheaders(body, encode_chunked=encode_chunked)\n   1328 \n\n/opt/conda/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)\n   1275             raise CannotSendHeader()\n-> 1276         self._send_output(message_body, encode_chunked=encode_chunked)\n   1277 \n\n/opt/conda/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)\n   1035         del self._buffer[:]\n-> 1036         self.send(msg)\n   1037 \n\n/opt/conda/lib/python3.7/http/client.py in send(self, data)\n    975             if self.auto_open:\n--> 976                 self.connect()\n    977             else:\n\n/opt/conda/lib/python3.7/http/client.py in connect(self)\n   1442 \n-> 1443             super().connect()\n   1444 \n\n/opt/conda/lib/python3.7/http/client.py in connect(self)\n    947         self.sock = self._create_connection(\n--> 948             (self.host,self.port), self.timeout, self.source_address)\n    949         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)\n\n/opt/conda/lib/python3.7/socket.py in create_connection(address, timeout, source_address)\n    706     err = None\n--> 707     for res in getaddrinfo(host, port, 0, SOCK_STREAM):\n    708         af, socktype, proto, canonname, sa = res\n\n/opt/conda/lib/python3.7/socket.py in getaddrinfo(host, port, family, type, proto, flags)\n    751     addrlist = []\n--> 752     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\n    753         af, socktype, proto, canonname, sa = res\n\ngaierror: [Errno -3] Temporary failure in name resolution\n\nDuring handling of the above exception, another exception occurred:\n\nURLError                                  Traceback (most recent call last)\n/tmp/ipykernel_25/3942314954.py in <module>\n      1 CONF= 0.15\n      2 IOU= 0.50\n----> 3 model = load_model(Best_Model, conf=CONF, iou=IOU)\n      4 for idx, (img, pred_df) in enumerate(tqdm(iter_test)):\n      5     bboxes, confs  = predict(model, img, size=IMG_SIZE, augment=True)\n\n/tmp/ipykernel_25/3261273385.py in load_model(Best_Model, conf, iou)\n      4                            path=Best_Model,\n      5                            source='local',\n----> 6                            force_reload=True)  # local repo\n      7     model.conf = conf  # NMS confidence threshold\n      8     model.iou  = iou  # NMS IoU threshold\n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)\n    380         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)\n    381 \n--> 382     model = _load_local(repo_or_dir, model, *args, **kwargs)\n    383     return model\n    384 \n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, **kwargs)\n    409 \n    410     entry = _load_entry_from_hubconf(hub_module, model)\n--> 411     model = entry(*args, **kwargs)\n    412 \n    413     sys.path.remove(hubconf_dir)\n\n/kaggle/working/yolov5/hubconf.py in custom(path, autoshape, verbose, device)\n     68 def custom(path='path/to/model.pt', autoshape=True, verbose=True, device=None):\n     69     # YOLOv5 custom or local model\n---> 70     return _create(path, autoshape=autoshape, verbose=verbose, device=device)\n     71 \n     72 \n\n/kaggle/working/yolov5/hubconf.py in _create(name, pretrained, channels, classes, autoshape, verbose, device)\n     29     from pathlib import Path\n     30 \n---> 31     from models.common import AutoShape, DetectMultiBackend\n     32     from models.yolo import Model\n     33     from utils.downloads import attempt_download\n\n/kaggle/working/yolov5/models/common.py in <module>\n     25 from utils.general import (LOGGER, check_requirements, check_suffix, check_version, colorstr, increment_path,\n     26                            make_divisible, non_max_suppression, scale_coords, xywh2xyxy, xyxy2xywh)\n---> 27 from utils.plots import Annotator, colors, save_one_box\n     28 from utils.torch_utils import copy_attr, time_sync\n     29 \n\n/kaggle/working/yolov5/utils/plots.py in <module>\n     66 \n     67 \n---> 68 class Annotator:\n     69     if RANK in (-1, 0):\n     70         check_font()  # download TTF if necessary\n\n/kaggle/working/yolov5/utils/plots.py in Annotator()\n     68 class Annotator:\n     69     if RANK in (-1, 0):\n---> 70         check_font()  # download TTF if necessary\n     71 \n     72     # YOLOv5 Annotator for train/val mosaics and jpgs and detect/hub inference annotations\n\n/kaggle/working/yolov5/utils/plots.py in check_font(font, size)\n     59         url = \"https://ultralytics.com/assets/\" + font.name\n     60         print(f'Downloading {url} to {font}...')\n---> 61         torch.hub.download_url_to_file(url, str(font), progress=False)\n     62         try:\n     63             return ImageFont.truetype(str(font), size)\n\n/opt/conda/lib/python3.7/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)\n    435     # certificates in older Python\n    436     req = Request(url, headers={\"User-Agent\": \"torch.hub\"})\n--> 437     u = urlopen(req)\n    438     meta = u.info()\n    439     if hasattr(meta, 'getheaders'):\n\n/opt/conda/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)\n    220     else:\n    221         opener = _opener\n--> 222     return opener.open(url, data, timeout)\n    223 \n    224 def install_opener(opener):\n\n/opt/conda/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)\n    523             req = meth(req)\n    524 \n--> 525         response = self._open(req, data)\n    526 \n    527         # post-process response\n\n/opt/conda/lib/python3.7/urllib/request.py in _open(self, req, data)\n    541         protocol = req.type\n    542         result = self._call_chain(self.handle_open, protocol, protocol +\n--> 543                                   '_open', req)\n    544         if result:\n    545             return result\n\n/opt/conda/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)\n    501         for handler in handlers:\n    502             func = getattr(handler, meth_name)\n--> 503             result = func(*args)\n    504             if result is not None:\n    505                 return result\n\n/opt/conda/lib/python3.7/urllib/request.py in https_open(self, req)\n   1391         def https_open(self, req):\n   1392             return self.do_open(http.client.HTTPSConnection, req,\n-> 1393                 context=self._context, check_hostname=self._check_hostname)\n   1394 \n   1395         https_request = AbstractHTTPHandler.do_request_\n\n/opt/conda/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)\n   1350                           encode_chunked=req.has_header('Transfer-encoding'))\n   1351             except OSError as err: # timeout error\n-> 1352                 raise URLError(err)\n   1353             r = h.getresponse()\n   1354         except:\n\nURLError: <urlopen error [Errno -3] Temporary failure in name resolution>`",
    "1642253": "Hi, you have to add Arial.ttf to your repository and then\n\n\n```\n!mkdir -p /root/.config/Ultralytics\n!cp ../input/your_repository/Arial.ttf /root/.config/Ultralytics/\n```",
    "1642376": "Thanks for your reply. I corrected my mistake and it works. I uploaded the Arial.tff in my dataset but did not properly create the Ultralytics folder in the root directory."
  },
  "source": "meta"
}