Skip to content

CAPI如加载图像数据 #8884

Closed
Closed
@yeyupiaoling

Description

@yeyupiaoling

这创建了一个数组,这个是不是要预测的数据呢?

// Fill the matrix with a randomly generated test sample.
srand(time(0));
for (int i = 0; i < 784; ++i) {
array[i] = rand() / ((float)RAND_MAX);
}

如果是Python的话,是要把图像生成一个一维数组的

def load_image(file):
    im = Image.open(file).convert('L')
    im = im.resize((28, 28), Image.ANTIALIAS)
    im = np.array(im).astype(np.float32).flatten()
    im = im / 255.0 * 2.0 - 1.0
    return im

CPP又应该怎么处理呢?

Metadata

Metadata

Labels

User用于标记用户问题

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions