when I run the C++ code in Visual Studio, the file read result are as follows：
then I copy the code to Vivado HLS and do C-simulation, HLS read the file, result are as follows:
obviously the data is wrong, so the result of the code is wrong too.
And when I read the train data label, it failed like this:
in Visual Studio(right):
it means 5,0,4,1...etc
as you can see, the reading result is not fully wrong but it's wrong indeed. can you help me?
the part code of reading file are as follows:
ifstream train_images("./train-images.idx3-ubyte", ios::binary | ios::in);
ifstream train_labels("./train-labels.idx1-ubyte", ios::binary | ios::in);
train_images.read(rubbish, 16); //4*32bit_integer
train_labels.read(rubbish, 8); //2*32bit_integer
for (int i = 0; i < batch_num * batch_size; i++)
for (int j = 0; j < IMAGE_SIZE; j++)
sw_train_data[i][j] = (unsigned char)image[j];
sw_train_data[i][j] /= 180.0;
//cout << sw_train_data[i][j] << " ";
for (int j = 0; j < OUT_SIZE; j++)
if (j == (unsigned char)num)
sw_train_label[i][j] = 1;
sw_train_label[i][j] = 0;
I tried to change the file path to absolute path but it doesnt work.
files are here.
thanks for your help!