当我使用来自 GoogleDrive 的连接时,我正在寻找一种解决方案来解决 google colab 上图像数据集上传速度缓慢的问题。使用以下代码:
from google.colab import drive
drive.mount('/content/gdrive')
Run Code Online (Sandbox Code Playgroud)
使用此程序,我可以使用 my 上传图像并创建标签def load_dataset
:
'train_path=content/gdrive/MyDrive/Capstone/Enviroment/cell_images/train'
train_files, train_targets = load_dataset(train_path)
但是,正如我所说,它非常慢,尤其是因为我的完整数据集由 27560 张图像组成。
为了解决我的问题,我尝试使用此解决方案。
但是现在,为了仍然使用我的def
功能,下载.tar
文件后我想在 colab 环境中的特定文件夹中解压缩。我找到了这个答案,但没有解决我的问题。
例子:
但我想提取 tar 文件中的文件,其结构是train/Uninfected
; train/Parasitized
,得到这个:
内容
要在 def 函数中使用路径:
train_path = train_path=content/cell_images/train/'
train_files, train_targets = load_dataset(train_path)
test_path = train_path=content/cell_images/test/'
test_files, test_targets = load_dataset(test_path)
valid_path = train_path=content/cell_images/valid/'
valid_files, …
我有一个愚蠢的问题。
我已经在scikit学习中完成了交叉验证,并希望使用我为每个模型获得的值做出更直观的信息。
但是,我不能仅访问要插入数据框的模板名称。总是随参数一起提供。是否创建了一些对象方法来仅访问模型名称而不访问其参数。还是我必须使用其名称创建一个外部列表?
我用:
for model in models:
scores = cross_val_score(model, X, y, cv=5)
print(f'Name model: {model} , Mean score: {scores.mean()}')
Run Code Online (Sandbox Code Playgroud)
但是我获得了带有参数的名称:
Name model: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False), Mean score: 0.8066782865537986
Run Code Online (Sandbox Code Playgroud)
实际上,我想通过以下方式获取信息:
Name Model: LinearRegression, Mean Score: 0.8066782865537986
Run Code Online (Sandbox Code Playgroud)
谢谢!