niente, non converge nemmeno con mnist

This commit is contained in:
2025-02-14 16:55:56 +01:00
parent e49dcb42b7
commit b1104d9fb4
9 changed files with 48 additions and 40 deletions

View File

@@ -9,6 +9,11 @@ Byte 16 in poi: Dati delle immagini (ogni immagine è composta da 28x28 = 784 by
Le immagini sono 28x28 pixel.
I dati sono byte non firmati (valori da 0 a 255).
Il file contiene 60.000 immagini (per il training set),
Label
Byte 0-3: Numero magico (0x00000801).
Byte 4-7: Numero di label (60.000).
Byte 8 in poi: 60.000 byte, ognuno dei quali rappresenta l'etichetta di un'immagine.
*/
#include <stdlib.h>
@@ -59,7 +64,7 @@ Dataset *get_dataset(char *path_mnist, char *path_categoria)
int numero_righe = 0;
//Leggo male il file, cambiare in base alle dichiarazioni sopra
if(fread(istanze[numero_righe].immagine, sizeof(byte), 16, file) == 16)
if(fread(istanze[numero_righe].immagine, sizeof(byte), 16, file) == 16 && fread(&istanze[numero_righe].categoria, sizeof(byte), 8, categorie) == 8)
while (fread(istanze[numero_righe].immagine, sizeof(byte), N_PIXEL, file) == N_PIXEL)
{
if(fread(&istanze[numero_righe].categoria, sizeof(byte), 1, categorie) == 1) {