smile-ffg / he-man-tenseal

HE-MAN – Homomorphically Encrypted MAchine learning with oNnx models and TenSEAL
Apache License 2.0
16 stars 3 forks source link

Problem with array #5

Open salvatorebuono02 opened 6 months ago

salvatorebuono02 commented 6 months ago

Considering the same configuration in #4 , I have a new error while run step 1 KeyParameters Generation. I pass my input files as single images with torch Dataloader using torch.tensors. Considering that I clone the repository and install all necessary libraries, how can I go on?

mrader1248 commented 5 months ago

Can you provide more information on how you run he-man-tenseal? Are you using the CLI?

salvatorebuono02 commented 5 months ago

Yes, I use the CLI. More specifically these are the steps:

  1. Create calibration-data.zip starting from my train folder, using images (jpeg format).
  2. Create onnx format of my model (it is a simple vgg with square activation instead of relu and average pooling instead of max pooling)
  3. create a venv and install dependencies
  4. using cli (I'm on linux) I put the following command he-man-tenseal keyparams -m demo/mnist/mnist.onnx -c demo/mnist/calibration-data.zip -o demo/mnist/keyparams.json

Should I change something?

mrader1248 commented 5 months ago

he-man-tenseal is completely agnostic of specific data formats (images, text, audio, ...). We simply load the calibration data using the np.load function (like .npz files are loaded). Therefore, the ZIP file has to contain numpy arrays in the .npy format. Please check the demo data for further details on the file format.

salvatorebuono02 commented 1 month ago

Now consider that I have pass all my train set (images as numpy array) as calibration_data.zip and I am sure that all images have the same size (88,88). I have problems with keyparams generation and this issue arises: click.exceptions.ClickException: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (31784,) + inhomogeneous part.