Quantum Transfer Learning Question

Hi @andreamari, I have some questions regarding the ImageNet dataset.

Has the Hymenoptera dataset already been trained on the truncated network? i.e is it unseen data for the entire network or just the dressed circuit?

Also, why is q_delta set to 0.01?



Hi @James_Ellis,

the truncated network (ResNet18) is pre-trained on the full ImageNet dataset. Hymenoptera is a very small subset of ImageNet.

So, ResNet18 has seen the Hymenoptera dataset a little bit. However it is not optimized on Hymenoptera but on the full ImageNet .

Note that this is not necessary and (classical or quantum) transfer learning can be applied also to a completely new dataset. You can find an example of this scenario in this notebook, where we replace the Hymenoptera dataset with CIFAR (which is unrelated to ImageNet).

Thanks for the reply! I appreciate the help.

Is there any reason why q_delta = 0.01?


Sorry, I forgot to reply about this.

No, there isn’t any particular reason for the choice of q_delta.
This can be considered as one of the hyper-parameters of the model.

The only thing that one can say is that it shouldn’t be be too small (risk of making the initial gradient null) and it shouldn’t be too large (risk of numerical instability of the optimization algorithm).

What is the purpose of apply Hadamard gates to each wire before embedding data? What would happen if we didn’t take this approach.

Thanks for your help!

Hi @James_Ellis,
since in our model we measure in the Z basis, the purpose of the Hadamard gates is to initialize all the qubits in a state which is not biased towards Z=+1 or Z=-1. Indeed the effect of H is to prepare the |+> state, for which the expectation value of Z is zero.

What would happen if we remove the first layer of H gates? Probably the final result would be similar but maybe the training time would be longer because of the different initial condition. This is just a guess, but the best way to know is to try and see how it goes.