[英]How to unzip image folder in colab
I want to train a deep learning model on a Devanagari dataset containing around 9000 images.我想在包含大约 9000 张图像的梵文数据集上训练深度学习模型。 Since the dataset is huge, I want to use Google colab since it's GPU supported.I uploaded folder from my local machine to Colab in Zip format .
由于数据集很大,我想使用 Google colab,因为它支持 GPU。我以 Zip 格式将文件夹从本地机器上传到 Colab。 But an error is occurred while unzipping file.
但是解压文件时出错。
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])))
When I tried following to unzip file当我尝试以下解压缩文件时
unzip devanagari-character-dataset.zip
I have following error.我有以下错误。
File "<ipython-input-8-92b289004693>", line 1
unzip devanagari-character-dataset.zip
^
SyntaxError: invalid syntax
How to solve above issue.如何解决上述问题。
import zipfile
with zipfile.ZipFile(path_to_zip_file, 'r') as zip_ref:
zip_ref.extractall(directory_to_extract_to)
Assuming python for that part假设那部分是python
unzip "devanagari-character-dataset.zip"
not不是
unzip devanagari-character-dataset.zip
Perhaps wrap it in quotes if you want it to be serviced by things installed with pip (then see @Vaibhav's answer)如果您希望使用 pip 安装的东西为它提供服务,可以用引号括起来(然后参见@Vaibhav 的答案)
OR: possibly precede it with a !或者:可能在它前面加上一个! to make it a command (if you want the backend to service it like a regular command line serviced by things installed with apt)
使其成为命令(如果您希望后端像使用 apt 安装的东西提供服务的常规命令行一样为其提供服务)
like喜欢
!unzip devanagari-character-dataset.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.