Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
51daaf4
Repo cleanup
LouisJustinTALLOT Jan 28, 2023
c0d0bd3
Cleanup 2
LouisJustinTALLOT Jan 28, 2023
bfc4091
Computations of theta_i
LouisJustinTALLOT Jan 28, 2023
1e21382
add loader images
LogarithmeNeper Jan 28, 2023
527d662
rm leftover
LogarithmeNeper Jan 28, 2023
c7fdc11
fix
LogarithmeNeper Jan 28, 2023
9cae9b0
Beginning the encoder circuit
LouisJustinTALLOT Jan 28, 2023
f950491
Merge branch 'main' of https://github.com/LouisJustinTALLOT/2023_IonQ…
LouisJustinTALLOT Jan 28, 2023
815f13b
incomplete function for FRQI encoding (rotation tbd)
LogarithmeNeper Jan 28, 2023
9e5e4ef
workingish with 3 qbits
LogarithmeNeper Jan 28, 2023
d4ffd1a
try with more
LogarithmeNeper Jan 28, 2023
f60f367
First draft FRQI
florian6973 Jan 28, 2023
0e51d9c
double check encoding
LogarithmeNeper Jan 28, 2023
f3d3b80
Fix encode qnd decode zip
florian6973 Jan 28, 2023
0bdfe18
Merge branch 'part1' of https://github.com/LouisJustinTALLOT/2023_Ion…
florian6973 Jan 28, 2023
ef69c9e
Decoding debug
florian6973 Jan 28, 2023
7fb0fc3
Test of the encoder
LouisJustinTALLOT Jan 28, 2023
5621a13
Update load function to account for small values of the dataset
LouisJustinTALLOT Jan 28, 2023
69e275e
wip decode
florian6973 Jan 28, 2023
8e26ee4
Merge branch 'part1' of https://github.com/LouisJustinTALLOT/2023_Ion…
florian6973 Jan 28, 2023
751e2cd
Fix NB
florian6973 Jan 28, 2023
453caf4
Seemingly working decode function
LouisJustinTALLOT Jan 28, 2023
df4a777
Merge branch 'part1' of https://github.com/LouisJustinTALLOT/2023_Ion…
LouisJustinTALLOT Jan 28, 2023
972a1e3
Cleanup
LouisJustinTALLOT Jan 28, 2023
93a6d6f
End of part1 cleanup
LouisJustinTALLOT Jan 28, 2023
3612f0b
Merge branch 'part1'
LouisJustinTALLOT Jan 28, 2023
c47827d
Fix clip
florian6973 Jan 28, 2023
bffebbf
clean + typing + grading part 1
LogarithmeNeper Jan 28, 2023
b36a7c2
added TODO for encoding
LogarithmeNeper Jan 28, 2023
200e502
Merge branch 'part1' of https://github.com/LouisJustinTALLOT/2023_Ion…
florian6973 Jan 28, 2023
e44936c
Merge no comment
florian6973 Jan 28, 2023
88b1538
img size fix
florian6973 Jan 28, 2023
44afa7c
Before optim, fix size display
florian6973 Jan 28, 2023
6a8d7d4
init part2
florian6973 Jan 29, 2023
8758ec4
Tool to compare images before and after part1 with a Tkinter GUI
LouisJustinTALLOT Jan 29, 2023
2347d3e
Comparison of the images in the terminal using Unicode characters
LouisJustinTALLOT Jan 29, 2023
5778e24
Adapt to the real size of the image
LouisJustinTALLOT Jan 29, 2023
dd15799
Quicker test results
LouisJustinTALLOT Jan 29, 2023
3f2bd45
placeholder base functions
LogarithmeNeper Jan 29, 2023
2146dec
before OOPing our way into hybrid arch for NN
LogarithmeNeper Jan 29, 2023
3b4ebfe
added Quantum Circuit as a class, plus placeholders towards Hybrid NN
LogarithmeNeper Jan 29, 2023
8e05612
added comments for classes
LogarithmeNeper Jan 29, 2023
0477e51
init HybridClassifier
LogarithmeNeper Jan 29, 2023
e81b6bf
init QuantumNet
LogarithmeNeper Jan 29, 2023
fa851e5
init ClassicalNet
LogarithmeNeper Jan 29, 2023
c62c032
forward HybridClassifier
LogarithmeNeper Jan 29, 2023
69c9e86
forward ClassicalNet
LogarithmeNeper Jan 29, 2023
90a86b3
placeholder autograd
LogarithmeNeper Jan 29, 2023
100df7c
newlines
LogarithmeNeper Jan 29, 2023
0f3aac6
forward backward :bug:
LogarithmeNeper Jan 29, 2023
70a859d
Multi qbits gates to 2qbits gate (except barrier)
florian6973 Jan 29, 2023
548a0d9
remove barriers
florian6973 Jan 29, 2023
9895fb3
forward-backward :debug:
LogarithmeNeper Jan 29, 2023
54cffd2
fix
LogarithmeNeper Jan 29, 2023
e33a2c1
Merge pull request #1 from LouisJustinTALLOT/part2
LogarithmeNeper Jan 29, 2023
d3faa9f
Final cleanup
LouisJustinTALLOT Jan 29, 2023
3f63a3d
Grading file
LouisJustinTALLOT Jan 29, 2023
968b511
Final submission
LouisJustinTALLOT Jan 29, 2023
878c329
Merge branch 'validate_part_1'
LouisJustinTALLOT Jan 29, 2023
f351d14
Merge remote-tracking branch 'origin/main'
LouisJustinTALLOT Jan 29, 2023
356453f
half classifier
LogarithmeNeper Jan 29, 2023
2b41e76
Final bugfixes
LouisJustinTALLOT Jan 29, 2023
0918b21
Final upscale
LouisJustinTALLOT Jan 29, 2023
04594dd
Fix
LouisJustinTALLOT Jan 29, 2023
d8f792f
Team name
LouisJustinTALLOT Jan 29, 2023
f2fa100
Forgot team_name variable
florian6973 Jan 30, 2023
4967419
Add requirements.txt
LouisJustinTALLOT Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
.ipynb_checkpoints
~*.docx
251 changes: 0 additions & 251 deletions .ipynb_checkpoints/examples-checkpoint.ipynb

This file was deleted.

226 changes: 0 additions & 226 deletions .ipynb_checkpoints/part1_example_cirq-checkpoint.ipynb

This file was deleted.

221 changes: 0 additions & 221 deletions .ipynb_checkpoints/part2_example_cirq-checkpoint.ipynb

This file was deleted.

Binary file removed __pycache__/part1.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/part1.cpython-39.pyc
Binary file not shown.
58 changes: 58 additions & 0 deletions compare_images_terminal_part1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import numpy as np

from part1 import load_images, run_part1

images = load_images("data/images.npy")


def value_to_text(value: int) -> str:
"""Divide the 0-255 interval in 5 parts using , ░░, ▒▒, ▓▓and ██"""
if value < 51:
return " "
elif value < 102:
return "░░"
elif value < 153:
return "▒▒"
elif value < 204:
return "▓▓"
elif value < 256:
return "██"


def display_images(left_image, right_image):
print("")
for i in range(left_image.shape[0]):
for j in range(left_image.shape[0]):
print(value_to_text(left_image[i][j]), end="")

print(" ", end="")
for j in range(left_image.shape[0]):
try:
print(value_to_text(right_image[i][j]), end="")
except IndexError:
print("", end="")
break
print("")

print("\n" + "Before".center(left_image.shape[0] * 2) + " " + "After".center(left_image.shape[0] * 2))


# update the images based on the entered number
num = int(input("Enter the number of the image you want to display: "))

try:
left_image = images[int(num)]
except IndexError:
left_image = np.ones((28, 28)) * 255


print(f"Computing for image n° {int(num)}...\n")

right_image = run_part1(left_image)[1]

print("Computing done!")

display_images(left_image, right_image)

print(left_image)
print(right_image)
87 changes: 87 additions & 0 deletions compare_images_tkinter_part1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import tkinter as tk
from PIL import Image, ImageTk
import numpy as np
from pprint import pprint

from part1 import load_images, run_part1

images = load_images("data/images.npy")


def update_images(num):
global left_image, right_image, left_photo, right_photo, left_label, right_label, status_label

try:
left_image = images[int(num)]
except IndexError:
left_image = np.ones((28, 28)) * 255

# update the images based on the entered number
print(f"Computing for image n° {int(num)}...")
right_image = run_part1(left_image)[1]
print("Right : ")
pprint(left_image)
print("Left : ")
pprint(right_image)
status_label.configure(text=f"Image n° {int(num)}")

# right_image = np.random.randint(0, 255, (28, 28))

left_photo = ImageTk.PhotoImage(
Image.fromarray(left_image).resize((280, 280), Image.BOX)
)
right_photo = ImageTk.PhotoImage(
Image.fromarray(right_image).resize((280, 280), Image.BOX)
)
left_label.configure(image=left_photo)
right_label.configure(image=right_photo)


# Create the main window
root = tk.Tk()
root.title("Image Viewer")

# Create the left image
left_image = images[0]
left_photo = ImageTk.PhotoImage(
Image.fromarray(left_image).resize((280, 280), Image.BOX)
)

# Create the right image
right_image = np.random.randint(0, 255, (28, 28))
right_photo = ImageTk.PhotoImage(
Image.fromarray(right_image).resize((280, 280), Image.BOX)
)

# Create the left image label and add it to the main window
left_label = tk.Label(root, image=left_photo)
left_label.grid(row=0, column=0)

# Create the right image label and add it to the main window
right_label = tk.Label(root, image=right_photo)
right_label.grid(row=0, column=1)

# Status label
status_label = tk.Label(root, text="Image n° 0")
status_label.grid(row=1, column=0, columnspan=2)

# Create a label for the number prompt
prompt_label = tk.Label(root, text="Enter a number:")
prompt_label.grid(row=2, column=0, columnspan=2)

# Create an entry widget for the number prompt
number_entry = tk.Entry(root)
number_entry.grid(row=3, column=0, columnspan=2)

# Create a button to update the images
update_button = tk.Button(
root, text="Update Images", command=lambda: update_images(number_entry.get())
)
update_button.grid(row=34, column=0, columnspan=2)

root.bind("<Return>", lambda e: update_images(number_entry.get()))

root.bind("<Escape>", lambda e: root.destroy())

# Run the main loop
root.mainloop()
Loading