christorange / qc-cnn Goto Github PK
View Code? Open in Web Editor NEWQuantum-classical hybrid convolutional neural network for classical image classification
License: MIT License
Quantum-classical hybrid convolutional neural network for classical image classification
License: MIT License
老哥
运行项目的时候 Devices是不是不能选择cuda
我看选用cuda后 optimizer.step()那边报错:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
量子微分是不是目前不能在gpu上 【基于pennylane】
老哥我又来了 我有个新问题
我有读Hybrid quantum-classical convolutional neural networks这篇论文
Hybrid QCCNN. The input demonstrated here is a two-dimensional array, which is sent to a quantum convolutional layer of 6
filters. 这个多个滤波器的概念如果要实现应该怎么修改呢 因为我看现在数据的通道数是从1变到N量子位 且受限于量子位(虽然量子机器学习的优势就是减少参数数量 但我总感觉用一个量子电路会不会不够) 正常我们Conv2d会有输入输出的通道数 也就是说滤波核是三维的(+通道) 我看现在您复现的QCCNN里面好像不是 我看其他复现QCCNN的好像也没通道这个概念 我不清楚我这样理解是否正确 希望能够得到您的指导
非常感谢
Pengl
Where need make modification?
Thanks you
Thanks you for you make this code, is very good for me understanding.
Here:
https://pennylane.ai/qml/demos/tutorial_quantum_transfer_learning.html
@qml.qnode(dev, interface="torch")
def quantum_net(q_input_features, q_weights_flat):
# Reshape weights
q_weights = q_weights_flat.reshape(q_depth, n_qubits)
# Start from state |+> , unbiased w.r.t. |0> and |1>
H_layer(n_qubits)
# Embed features in the quantum node
RY_layer(q_input_features)
# Sequence of trainable variational layers
for k in range(q_depth):
entangling_layer(n_qubits)
RY_layer(q_weights[k])
# Expectation values in the Z basis
exp_vals = [[qml.expval](https://docs.pennylane.ai/en/stable/code/api/pennylane.expval.html#pennylane.expval)([qml.PauliZ]
(https://docs.pennylane.ai/en/stable/code/api/pennylane.PauliZ.html#pennylane.PauliZ)(position)) for position in range(n_qubits)]
return tuple(exp_vals)
He make use of reshape weights, but your code no make use. Why? Whts is difference?
x_lst = []
for i in range(0, x.shape[2]-1,2):
for j in range(0, x.shape[3]-1,2):
x_lst.append(self.ql1(torch.flatten(x[:, :, i:i + self.kernel_size, j:j + self.kernel_size], start_dim=1)))
x = torch.cat(x_lst,dim=1) # .view(bs,n_qubits,14,14)
What is the prupose of x_lst and make loop after? I no understand.
If want make process 64x64 image, what change neem make?
Thanks you and sorry for bad english.
Hi @christorange ,
You have done a fabulous work. I would like to run on my custom image dataset where image size is quite larger 416x416. But if i convert to csv its very large, can you please help me to execute in such configuration.
因为最近导师给的方向是经典神经网络加一点量子,那么对于传统的目标检测,比如ssd算法的话,我现在想的是将传统的2d卷积换成量子卷积,但是我觉得因为输入会很大,比如对一个3030256的输入进行量子卷积,输出成1515256的,使用量子卷积的话,可以实现出来嘛
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.