Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在colab中解压缩图像文件夹_Python_Deep Learning - Fatal编程技术网

Python 如何在colab中解压缩图像文件夹

Python 如何在colab中解压缩图像文件夹,python,deep-learning,Python,Deep Learning,我想在包含9000张左右图像的Devanagari数据集上训练一个深度学习模型。由于数据集很大,我想使用Google colab,因为它支持GPU。我以Zip格式将文件夹从本地机器上传到colab。但解压缩文件时出错。 from google.colab import files uploaded = files.upload() for fn in uploaded.keys(): print('User uploaded file "{name}" with length {

我想在包含9000张左右图像的Devanagari数据集上训练一个深度学习模型。由于数据集很大,我想使用Google colab,因为它支持GPU。我以Zip格式将文件夹从本地机器上传到colab。但解压缩文件时出错。

    from google.colab import files

uploaded = files.upload()

for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))
      File "<ipython-input-8-92b289004693>", line 1
        unzip devanagari-character-dataset.zip
                       ^

SyntaxError: invalid syntax
import zipfile
with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
    zip_ref.extractall(directory_to_extract_to)
当我尝试按以下步骤解压文件时

unzip devanagari-character-dataset.zip  
我有以下错误。

    from google.colab import files

uploaded = files.upload()

for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))
      File "<ipython-input-8-92b289004693>", line 1
        unzip devanagari-character-dataset.zip
                       ^

SyntaxError: invalid syntax
文件“”,第1行
解压缩devanagari-character-dataset.zip
^
SyntaxError:无效语法

如何解决上述问题。

请在回答中添加一些解释。答案是直截了当的,并且可以理解。
    from google.colab import files

uploaded = files.upload()

for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))
      File "<ipython-input-8-92b289004693>", line 1
        unzip devanagari-character-dataset.zip
                       ^

SyntaxError: invalid syntax
import zipfile
with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
    zip_ref.extractall(directory_to_extract_to)