我有自己的深度学习项目数据集。我将其上传到 Google Drive 并将其链接到 Colab 页面。但是 Colab 一秒钟只能读取 2-3 张图片,而我的电脑可以读取几十张图片。(我使用 imread 来读取图像。)
keras 的模型编译过程没有速度问题,但只能从 Google Drive 读取图像。有人知道解决方案吗?有人也遇到过这个问题,但仍未解决:Google Colab 从 Google Drive 读取数据(图像)的速度非常慢(我知道这是链接中问题的重复,但我重新发布了它,因为它仍未解决。我希望这不会违反 Stack Overflow 规则。)
编辑:我用于读取图像的代码段:
def getDataset(path, classes, pixel=32, rate=0.8):
X = []
Y = []
i = 0
# getting images:
for root, _, files in os.walk(path):
for file in files:
imagePath = os.path.join(root, file)
className = os.path.basename(root)
try:
image = Image.open(imagePath)
image = np.asarray(image)
image = np.array(Image.fromarray(image.astype('uint8')).resize((pixel, pixel)))
image = image if len(image.shape) == …Run Code Online (Sandbox Code Playgroud) 我有一个土耳其语单词列表。我需要比较它们的长度。但是由于一些土耳其语字符是非ASCII,我无法正确比较它们的长度。非 ASCII 土耳其语字符占 2 个字节。
例如:
#include <stdio.h>
#include <string.h>
int main()
{
char s1[] = "ab";
char s2[] = "ç?";
printf("%d\n", strlen(s1)); // it prints 2
printf("%d\n", strlen(s2)); // it prints 4
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我的朋友说可以在 Windows 中使用以下代码行做到这一点:
system("chcp 1254");
Run Code Online (Sandbox Code Playgroud)
他说它将土耳其字符填充到扩展的 ASCII 表中。但是它在 Linux 中不起作用。
有没有办法在 Linux 中做到这一点?