download_save_and_freeze_mobilenet.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:imagenet_models_flask 作者: alesolano 项目源码 文件源码
def download_and_uncompress_tarball(base_url, filename, data_dir):

  def _progress(count, block_size, total_size):
    stdout.write('\r>> Downloading %s %.1f%%' % (
        filename, float(count * block_size) / float(total_size) * 100.0))
    stdout.flush()

  tarball_url = base_url + filename
  filepath = osp.join(data_dir, filename)

  if not tf.gfile.Exists( osp.join(download_dir, model_dl) ):
    filepath, _ = urllib.request.urlretrieve(tarball_url, filepath, _progress)
    print()
    statinfo = stat(filepath)
    print('Successfully downloaded', filename, statinfo.st_size, 'bytes.')
  else:
    print('{} tarball already exists -- not downloading'.format(filename))

  tarfile.open(filepath, 'r:*').extractall(data_dir)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号