Python 从colab执行文件
我正在使用暗色代码进行YOLO对象检测。我已经为我的数据集定制了它,它在我的本地计算机上运行良好。但是,当我将代码上传到google drive,并尝试使用代码从Colab的新jupyter笔记本执行代码时:Python 从colab执行文件,python,machine-learning,deep-learning,computer-vision,google-colaboratory,Python,Machine Learning,Deep Learning,Computer Vision,Google Colaboratory,我正在使用暗色代码进行YOLO对象检测。我已经为我的数据集定制了它,它在我的本地计算机上运行良好。但是,当我将代码上传到google drive,并尝试使用代码从Colab的新jupyter笔记本执行代码时: %shell ./darknet detector train custom_data/detector.data custom_data/cfg/yolov3-custom.cfg darknet53.conv.74 yolov3-custom 我得到一个错误: bin/bash: .
%shell ./darknet detector train custom_data/detector.data custom_data/cfg/yolov3-custom.cfg darknet53.conv.74 yolov3-custom
我得到一个错误:
bin/bash: ./darknet: No such file or directory
我真的被困在这,任何建议都会非常有用,谢谢 如果文件太大,请尝试导入该文件:
from google.colab import files
uploaded = files.upload
这将允许您从计算机下载文件上载文件夹的压缩文件,然后使用
!unzip "/content/drive/My Drive/darknet.zip"
文件夹现在显示在
root
目录本身中,而不是content/drive/My drive
文件在哪里。/darknet?你上传到colab了吗?是的,这是我上传到google drive的一个文件夹,darknet是一个exec文件。我想colab无法执行darknet文件(这是一个exec文件),请查看此链接。按照说明进行配置,步骤3是您需要的代码。如果已尝试此操作,请忽略。上载文件夹的zip并使用解压!解压“/content/drive/My drive/darknet.zip”
works它会被永久下载,还是在我再次通过colab笔记本打开后会丢失它。@SurajSubramanian我相信是的,我肯定知道它在colab文件中,所以我会这么认为。你试过了吗?我只能用你的代码上传文件,如何上传整个目录?@SurajSubramanian抱歉,我真的不知道。您可以尝试压缩文件夹,然后从google.colab导入drive.mount('/content/drive'),然后将其解压缩!解压-uq“/content/drive/My drive/PATH_TO_ZIP”-d“/content/drive/My drive/PATH_TO_OUTPUT”。如果这不起作用,你将不得不继续寻找我很抱歉