diff --git a/cuby.blend b/cuby.blend index b7274c3..410d68a 100644 Binary files a/cuby.blend and b/cuby.blend differ diff --git a/docs/figs/fvi.png b/docs/figs/fvi.png new file mode 100644 index 0000000..1a503fe Binary files /dev/null and b/docs/figs/fvi.png differ diff --git a/docs/figs/lvl7_2D.gif b/docs/figs/lvl7_2D.gif new file mode 100644 index 0000000..4e739d9 Binary files /dev/null and b/docs/figs/lvl7_2D.gif differ diff --git a/docs/figs/lvl7_3D.gif b/docs/figs/lvl7_3D.gif new file mode 100755 index 0000000..34f4cfe Binary files /dev/null and b/docs/figs/lvl7_3D.gif differ diff --git a/docs/slides.md b/docs/slides.md index cf5f4b0..df2c6c0 100644 --- a/docs/slides.md +++ b/docs/slides.md @@ -2,8 +2,7 @@ theme: academic class: text-white coverAuthor: Laurent Fainsin, Damien Guillotin, Pierre-Eliot Jourdan -coverBackgroundUrl: >- - https://images.unsplash.com/photo-1655720408861-8b04c0724fd9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8 +coverBackgroundUrl: https://images.unsplash.com/photo-1655720408861-8b04c0724fd9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8 coverBackgroundSource: unplash coverBackgroundSourceUrl: https://unsplash.com/photos/Vc0CmuIfMg0 coverDate: '2023-01-05' @@ -27,6 +26,12 @@ Sujet 6 - Reformulation du MVS par level sets --- +## Level sets 2D animé + + + +--- + ## Exemple Level sets 2D @@ -36,3 +41,39 @@ Sujet 6 - Reformulation du MVS par level sets Variational principles, surface evolution, PDEs, level set methods, and the stereo problem - Olivier Faugeras, Renaud Keriven, 1998 + +---- + +## Exemple Level sets 3D + + + +--- + +## Approximation du volume + +$\mu_t = \{ Q \in \mathbb{R}^3, u(Q) = t \}, t\in [0,1]\ \text{ou}\ t \in \{0, 1\}$ + +--- + +## Raytracing + + + +--- + +## Raytracing + + + +--- + +## Raytracing + + + +--- + +## Raytracing + + diff --git a/src/levelset.py b/src/levelset.py index 3345ef2..3e31567 100644 --- a/src/levelset.py +++ b/src/levelset.py @@ -1,9 +1,9 @@ +import imageio.v2 as imageio +import matplotlib.pyplot as plt import mcubes import numpy as np -import matplotlib.pyplot as plt -import imageio.v2 as imageio import perlin_noise - +from rich.progress import track # X, Y, Z = np.mgrid[:100, :100, :100] # V = np.sqrt((X - 50)**2 + (Y - 50)**2 + (Z - 50)**2) @@ -15,25 +15,29 @@ import perlin_noise noise = perlin_noise.PerlinNoise(octaves=6, seed=1) X, Y = np.mgrid[:100, :100] -V = [[10 * noise([x/100, y/100]) + np.sqrt((x-50)**2 + (y-50)**2) for y in range(100)] for x in range(100)] +V = [[10 * noise([x / 100, y / 100]) + np.sqrt((x - 50) ** 2 + (y - 50) ** 2) for y in range(100)] for x in range(100)] V = np.array(V) V = (V - V.min()) / (V.max() - V.min()) frame_list = [] -for i in np.linspace(0.05, 0.55, 100): +for i in track(np.linspace(0.05, 0.55, 100)): plt.clf() plt.subplot(1, 2, 1) plt.imshow(V, cmap="gray") plt.contour(V, [i], colors="r") plt.plot([0, 0, 100, 100, 0], [0, 100, 100, 0, 0], "k-") - plt.axis('off') + plt.xlim(0, 100) + plt.ylim(0, 100) + plt.axis("off") plt.subplot(1, 2, 2) plt.imshow(V > i, cmap="gray") plt.plot([0, 0, 100, 100, 0], [0, 100, 100, 0, 0], "k-") - plt.axis('off') + plt.xlim(0, 100) + plt.ylim(0, 100) + plt.axis("off") - plt.savefig(f"/tmp/frame.png") + plt.savefig(f"/tmp/frame.png", dpi=300, bbox_inches="tight", pad_inches=0, transparent=True) frame_list.append(imageio.imread(f"/tmp/frame.png")) -imageio.mimsave('picture.gif', frame_list + frame_list[::-1], fps=60) +imageio.mimsave("docs/figs/lvl7.gif", frame_list + frame_list[::-1], fps=60) diff --git a/tmp.py b/tmp.py new file mode 100644 index 0000000..d5e9420 --- /dev/null +++ b/tmp.py @@ -0,0 +1,1326 @@ +import re + +import matplotlib.pyplot as plt + +h1 = { + "loss": [], + "c_acc": [], + "top1": [], + "top3": [], + "top5": [], + "val_loss": [], + "val_top1": [], + "val_top3": [], + "val_top5": [], +} +h2 = { + "loss": [], + "c_acc": [], + "top1": [], + "top3": [], + "top5": [], + "val_loss": [], + "val_top1": [], + "val_top3": [], + "val_top5": [], +} +h3 = { + "loss": [], + "c_acc": [], + "top1": [], + "top3": [], + "top5": [], + "val_loss": [], + "val_top1": [], + "val_top3": [], + "val_top5": [], +} + +d1 = { + "train": { + "top1": [ + 0.25, + 0.3828125, + 0.515625, + 0.6015625, + 0.5625, + 0.6875, + 0.734375, + 0.7734375, + 0.6875, + 0.8046875, + 0.765625, + 0.8046875, + 0.84375, + 0.796875, + 0.8203125, + 0.84375, + 0.8203125, + 0.7734375, + 0.90625, + 0.8046875, + 0.8203125, + 0.890625, + 0.8515625, + 0.921875, + 0.9296875, + 0.875, + 0.875, + 0.8828125, + 0.90625, + 0.921875, + 0.875, + 0.8515625, + 0.875, + 0.890625, + 0.8828125, + 0.921875, + 0.8984375, + 0.921875, + 0.8671875, + 0.921875, + 0.8984375, + 0.9140625, + 0.8671875, + 0.8828125, + 0.9296875, + 0.84375, + 0.9296875, + 0.9296875, + 0.9140625, + 0.921875, + 0.921875, + 0.9296875, + 0.8984375, + 0.9375, + 0.9453125, + 0.8984375, + 0.96875, + 0.96875, + 0.921875, + 0.9609375, + 0.90625, + 0.953125, + 0.9453125, + 0.90625, + 0.9453125, + 0.9765625, + 0.96875, + 0.90625, + 0.9453125, + 0.9453125, + 0.921875, + 0.984375, + 0.953125, + 0.9375, + 0.921875, + 0.8984375, + 0.9765625, + 0.921875, + 0.9765625, + 0.953125, + 0.953125, + 0.9609375, + 0.9609375, + 0.9453125, + 0.96875, + 0.8984375, + 0.953125, + 0.953125, + 0.953125, + 0.890625, + 0.90625, + 0.9609375, + 0.9453125, + 0.9609375, + 0.8828125, + 0.9921875, + 0.9296875, + 0.9609375, + 0.9453125, + 0.9765625, + ], + "top3": [ + 0.5078125, + 0.625, + 0.7421875, + 0.890625, + 0.7578125, + 0.859375, + 0.8828125, + 0.96875, + 0.8984375, + 0.921875, + 0.9140625, + 0.9296875, + 0.9296875, + 0.953125, + 0.9140625, + 0.953125, + 0.9453125, + 0.9453125, + 0.984375, + 0.9296875, + 0.953125, + 0.953125, + 0.984375, + 0.96875, + 0.9765625, + 0.9609375, + 0.9765625, + 0.96875, + 0.984375, + 0.9609375, + 0.9765625, + 0.96875, + 0.9296875, + 0.96875, + 1.0, + 0.9765625, + 0.984375, + 0.984375, + 0.9296875, + 0.9921875, + 0.9765625, + 0.96875, + 0.9921875, + 0.9765625, + 0.96875, + 0.9609375, + 0.9921875, + 0.984375, + 0.96875, + 1.0, + 0.9921875, + 0.96875, + 0.9453125, + 0.9921875, + 1.0, + 0.9765625, + 1.0, + 1.0, + 0.984375, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.96875, + 0.9921875, + 0.9921875, + 1.0, + 0.9921875, + 0.9921875, + 0.9921875, + 0.984375, + 1.0, + 0.9921875, + 0.984375, + 0.9921875, + 0.984375, + 1.0, + 0.9921875, + 1.0, + 0.9765625, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9765625, + 0.9765625, + 0.96875, + 0.9921875, + 1.0, + 0.984375, + 0.9921875, + 0.984375, + 0.984375, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9765625, + 1.0, + ], + }, + "val": { + "top1": [ + 0.1616666615009308, + 0.16944444179534912, + 0.1688888818025589, + 0.1666666716337204, + 0.16388888657093048, + 0.17777778208255768, + 0.18222221732139587, + 0.18222221732139587, + 0.17777778208255768, + 0.1738888919353485, + 0.1711111068725586, + 0.19499999284744263, + 0.18166667222976685, + 0.1827777773141861, + 0.17944444715976715, + 0.18777777254581451, + 0.18444444239139557, + 0.18222221732139587, + 0.18444444239139557, + 0.18888889253139496, + 0.19833333790302277, + 0.19722221791744232, + 0.18888889253139496, + 0.19611111283302307, + 0.1922222226858139, + 0.1899999976158142, + 0.19499999284744263, + 0.21111111342906952, + 0.20222222805023193, + 0.19555555284023285, + 0.20333333313465118, + 0.1944444477558136, + 0.18666666746139526, + 0.18388888239860535, + 0.18722222745418549, + 0.19277778267860413, + 0.18888889253139496, + 0.212777778506279, + 0.20666666328907013, + 0.20777778327465057, + 0.19277778267860413, + 0.19277778267860413, + 0.19611111283302307, + 0.19277778267860413, + 0.21166667342185974, + 0.20555555820465088, + 0.20555555820465088, + 0.2105555534362793, + 0.20444443821907043, + 0.20499999821186066, + 0.2061111181974411, + 0.21222221851348877, + 0.2011111080646515, + 0.19499999284744263, + 0.2083333283662796, + 0.1988888829946518, + 0.2038888931274414, + 0.20777778327465057, + 0.212777778506279, + 0.22166666388511658, + 0.21666666865348816, + 0.22055555880069733, + 0.20000000298023224, + 0.2177777737379074, + 0.2222222238779068, + 0.22333332896232605, + 0.2222222238779068, + 0.22277778387069702, + 0.21833333373069763, + 0.20722222328186035, + 0.21833333373069763, + 0.2150000035762787, + 0.2133333384990692, + 0.21722222864627838, + 0.21888889372348785, + 0.20999999344348907, + 0.2244444489479065, + 0.21166667342185974, + 0.21166667342185974, + 0.2177777737379074, + 0.2266666740179062, + 0.21166667342185974, + 0.22555555403232574, + 0.19777777791023254, + 0.23111110925674438, + 0.20666666328907013, + 0.21222221851348877, + 0.21555554866790771, + 0.20555555820465088, + 0.212777778506279, + 0.21611110866069794, + 0.20777778327465057, + 0.212777778506279, + 0.21444444358348846, + 0.2199999988079071, + 0.21944443881511688, + 0.2199999988079071, + 0.2061111181974411, + 0.20999999344348907, + 0.2222222238779068, + ], + "top3": [ + 0.38777777552604675, + 0.36944442987442017, + 0.3861111104488373, + 0.3916666805744171, + 0.3766666650772095, + 0.3977777659893036, + 0.38777777552604675, + 0.39888888597488403, + 0.39888888597488403, + 0.40833333134651184, + 0.398333340883255, + 0.40666666626930237, + 0.40611112117767334, + 0.41111111640930176, + 0.41499999165534973, + 0.41333332657814026, + 0.426111102104187, + 0.4033333361148834, + 0.4194444417953491, + 0.4194444417953491, + 0.43666666746139526, + 0.4211111068725586, + 0.4072222113609314, + 0.4216666519641876, + 0.42722222208976746, + 0.41777777671813965, + 0.4233333468437195, + 0.43166667222976685, + 0.43833333253860474, + 0.4327777922153473, + 0.4238888919353485, + 0.41499999165534973, + 0.4033333361148834, + 0.4211111068725586, + 0.4161111116409302, + 0.41055554151535034, + 0.43111109733581543, + 0.43444445729255676, + 0.4283333420753479, + 0.44388890266418457, + 0.4216666519641876, + 0.42444443702697754, + 0.4216666519641876, + 0.4161111116409302, + 0.43833333253860474, + 0.4211111068725586, + 0.4238888919353485, + 0.4305555522441864, + 0.4233333468437195, + 0.4327777922153473, + 0.4305555522441864, + 0.44777777791023254, + 0.4211111068725586, + 0.43833333253860474, + 0.43833333253860474, + 0.43833333253860474, + 0.43444445729255676, + 0.43111109733581543, + 0.44611111283302307, + 0.44999998807907104, + 0.4483333230018616, + 0.4427777826786041, + 0.4355555474758148, + 0.44333332777023315, + 0.4399999976158142, + 0.44611111283302307, + 0.4427777826786041, + 0.43888887763023376, + 0.4394444525241852, + 0.43833333253860474, + 0.4449999928474426, + 0.45722222328186035, + 0.4422222077846527, + 0.44555556774139404, + 0.4538888931274414, + 0.4444444477558136, + 0.46222221851348877, + 0.4350000023841858, + 0.4427777826786041, + 0.46888887882232666, + 0.4605555534362793, + 0.4605555534362793, + 0.4627777636051178, + 0.4211111068725586, + 0.4577777683734894, + 0.4588888883590698, + 0.45055556297302246, + 0.45444443821907043, + 0.4516666531562805, + 0.44999998807907104, + 0.43888887763023376, + 0.44555556774139404, + 0.4466666579246521, + 0.43833333253860474, + 0.4444444477558136, + 0.4555555582046509, + 0.4605555534362793, + 0.4633333384990692, + 0.43666666746139526, + 0.45055556297302246, + ], + }, +} +d2 = { + "train": { + "top1": [ + 0.3125, + 0.5703125, + 0.6875, + 0.7890625, + 0.8203125, + 0.8125, + 0.859375, + 0.921875, + 0.890625, + 0.8828125, + 0.8828125, + 0.8828125, + 0.859375, + 0.890625, + 0.875, + 0.8671875, + 0.890625, + 0.9140625, + 0.921875, + 0.8671875, + 0.9296875, + 0.9453125, + 0.921875, + 0.9453125, + 0.9453125, + 0.9453125, + 0.96875, + 0.9296875, + 0.9140625, + 0.90625, + 0.9765625, + 0.9296875, + 0.8984375, + 0.890625, + 0.9453125, + 0.8984375, + 0.953125, + 0.9140625, + 0.9375, + 0.90625, + 0.921875, + 0.9296875, + 0.9375, + 0.953125, + 0.9296875, + 0.9453125, + 0.9453125, + 0.953125, + 0.96875, + 0.921875, + 0.96875, + 0.96875, + 0.9921875, + 0.9765625, + 0.9921875, + 0.9609375, + 0.9609375, + 0.9765625, + 0.96875, + 0.9609375, + 0.9609375, + 0.984375, + 0.9765625, + 0.984375, + 0.95703125, + 0.97265625, + 0.96875, + 0.94921875, + 0.98046875, + 0.97265625, + 0.96484375, + 0.9765625, + 0.98046875, + 0.953125, + 0.97265625, + 0.9453125, + 0.97265625, + 0.953125, + 0.9453125, + 0.9609375, + 0.94921875, + 0.9765625, + 0.96875, + 0.96875, + 0.9453125, + 0.9453125, + 0.9609375, + 0.97265625, + 0.94921875, + 0.9765625, + 0.96875, + 0.96875, + 0.95703125, + 0.97265625, + 0.9609375, + 0.95703125, + 0.9609375, + 0.9609375, + 0.96875, + 0.98046875, + ], + "top3": [ + 0.609375, + 0.796875, + 0.875, + 0.9296875, + 0.96875, + 0.96875, + 0.9609375, + 0.9921875, + 0.9765625, + 0.9765625, + 0.9609375, + 0.9609375, + 0.9921875, + 0.9765625, + 0.984375, + 0.9765625, + 0.9765625, + 0.984375, + 0.984375, + 0.96875, + 0.984375, + 0.984375, + 0.9765625, + 0.9765625, + 1.0, + 0.9921875, + 1.0, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.9921875, + 0.984375, + 1.0, + 0.9921875, + 0.984375, + 0.9921875, + 0.96875, + 0.984375, + 0.9921875, + 0.984375, + 0.9609375, + 0.9765625, + 1.0, + 1.0, + 0.9921875, + 0.9921875, + 1.0, + 1.0, + 0.984375, + 0.9921875, + 0.984375, + 0.9921875, + 1.0, + 1.0, + 0.9765625, + 1.0, + 1.0, + 0.9921875, + 0.984375, + 0.984375, + 1.0, + 0.9921875, + 1.0, + 0.984375, + 1.0, + 0.9921875, + 1.0, + 0.9921875, + 0.99609375, + 0.98828125, + 0.99609375, + 0.99609375, + 0.9921875, + 1.0, + 0.9921875, + 1.0, + 0.99609375, + 0.9921875, + 0.98046875, + 0.984375, + 0.9921875, + 0.9921875, + 0.99609375, + 0.984375, + 1.0, + 0.98828125, + 0.99609375, + 0.9921875, + 0.99609375, + 0.9921875, + 1.0, + 0.9921875, + 0.9921875, + 0.9921875, + 0.99609375, + 0.9921875, + 0.9921875, + 0.99609375, + 1.0, + ], + }, + "val": { + "top1": [ + 0.14944444596767426, + 0.19499999284744263, + 0.20944444835186005, + 0.20555555820465088, + 0.19777777791023254, + 0.21555554866790771, + 0.21944443881511688, + 0.2222222238779068, + 0.22055555880069733, + 0.2199999988079071, + 0.22611111402511597, + 0.21166667342185974, + 0.20333333313465118, + 0.20944444835186005, + 0.21833333373069763, + 0.2177777737379074, + 0.2244444489479065, + 0.23000000417232513, + 0.21833333373069763, + 0.21944443881511688, + 0.2199999988079071, + 0.22055555880069733, + 0.23222222924232483, + 0.22499999403953552, + 0.2361111044883728, + 0.22166666388511658, + 0.22555555403232574, + 0.22388888895511627, + 0.23222222924232483, + 0.2294444441795349, + 0.2288888841867447, + 0.2338888943195343, + 0.22555555403232574, + 0.24111111462116241, + 0.23944444954395294, + 0.2199999988079071, + 0.21222221851348877, + 0.22333332896232605, + 0.2294444441795349, + 0.23777778446674347, + 0.23055554926395416, + 0.23666666448116302, + 0.23222222924232483, + 0.22333332896232605, + 0.23222222924232483, + 0.2199999988079071, + 0.22833333909511566, + 0.22055555880069733, + 0.23888888955116272, + 0.23222222924232483, + 0.2405555546283722, + 0.24722221493721008, + 0.24388888478279114, + 0.253888875246048, + 0.24388888478279114, + 0.24166665971279144, + 0.2522222101688385, + 0.25, + 0.24666666984558105, + 0.24666666984558105, + 0.24611110985279083, + 0.25, + 0.2455555498600006, + 0.24500000476837158, + 0.23722221702337265, + 0.23722222447395325, + 0.2474999949336052, + 0.24638888239860535, + 0.24611111730337143, + 0.23944444209337234, + 0.2361111044883728, + 0.24277778714895248, + 0.2408333346247673, + 0.23944444209337234, + 0.23722222447395325, + 0.23749999701976776, + 0.24694444984197617, + 0.23944444209337234, + 0.24694444984197617, + 0.24472222477197647, + 0.2405555471777916, + 0.25138889253139496, + 0.24472221732139587, + 0.24472223222255707, + 0.23666666448116302, + 0.24444445222616196, + 0.24583332985639572, + 0.24499999731779099, + 0.24500000476837158, + 0.24277778714895248, + 0.2386111095547676, + 0.24111110717058182, + 0.2427777722477913, + 0.23555555939674377, + 0.24166666716337204, + 0.2338888943195343, + 0.2455555498600006, + 0.24833333492279053, + 0.24583332985639572, + 0.24833333492279053, + ], + "top3": [ + 0.36944442987442017, + 0.42444443702697754, + 0.4322222173213959, + 0.42888888716697693, + 0.4372222125530243, + 0.44777777791023254, + 0.4561111032962799, + 0.44388890266418457, + 0.4355555474758148, + 0.44111111760139465, + 0.43888887763023376, + 0.449444442987442, + 0.4350000023841858, + 0.4350000023841858, + 0.43888887763023376, + 0.4561111032962799, + 0.4583333432674408, + 0.45222222805023193, + 0.4444444477558136, + 0.4394444525241852, + 0.44555556774139404, + 0.4511111080646515, + 0.44555556774139404, + 0.45277777314186096, + 0.4511111080646515, + 0.4533333480358124, + 0.4699999988079071, + 0.4583333432674408, + 0.448888897895813, + 0.4533333480358124, + 0.44555556774139404, + 0.45722222328186035, + 0.44055554270744324, + 0.4588888883590698, + 0.4566666781902313, + 0.4511111080646515, + 0.46222221851348877, + 0.44388890266418457, + 0.46222221851348877, + 0.46166667342185974, + 0.46000000834465027, + 0.4605555534362793, + 0.4561111032962799, + 0.4611110985279083, + 0.45444443821907043, + 0.449444442987442, + 0.4650000035762787, + 0.46388888359069824, + 0.46611112356185913, + 0.448888897895813, + 0.4677777886390686, + 0.4744444489479065, + 0.4833333194255829, + 0.47999998927116394, + 0.476666659116745, + 0.476666659116745, + 0.4694444537162781, + 0.4744444489479065, + 0.48055556416511536, + 0.48055556416511536, + 0.4744444489479065, + 0.46666666865348816, + 0.4716666638851166, + 0.46888887882232666, + 0.47361111640930176, + 0.46611110866069794, + 0.4808333218097687, + 0.46694445610046387, + 0.4791666716337204, + 0.46611110866069794, + 0.4672222286462784, + 0.46638888120651245, + 0.47138889133930206, + 0.46222221851348877, + 0.46638888120651245, + 0.4680555611848831, + 0.48472222685813904, + 0.46888887882232666, + 0.46416665613651276, + 0.47111111879348755, + 0.4599999934434891, + 0.47083333134651184, + 0.46833333373069763, + 0.46416667103767395, + 0.4699999988079071, + 0.4769444465637207, + 0.4675000011920929, + 0.47138889133930206, + 0.4669444411993027, + 0.46916666626930237, + 0.47138889133930206, + 0.47111111879348755, + 0.4722222089767456, + 0.4602777659893036, + 0.4719444364309311, + 0.464722216129303, + 0.474166676402092, + 0.4725000113248825, + 0.4797222167253494, + 0.47333334386348724, + ], + }, +} +d3 = { + "train": { + "top1": [ + 0.640625, + 0.76953125, + 0.83984375, + 0.8828125, + 0.90625, + 0.9609375, + 0.9609375, + 0.9765625, + 0.96875, + 0.9609375, + 0.9609375, + 0.984375, + 0.9765625, + 0.984375, + 1.0, + 0.9765625, + 0.9921875, + 0.984375, + 0.96875, + 0.9765625, + 0.96875, + 0.984375, + 0.96875, + 0.9921875, + 0.96875, + 0.9609375, + 0.96875, + 0.96875, + 0.9921875, + 0.96875, + 0.9765625, + 0.96875, + 0.953125, + 0.9921875, + 0.9453125, + 0.96875, + 0.953125, + 0.96875, + 0.9609375, + 0.984375, + 0.953125, + 0.9609375, + 0.9609375, + 0.96875, + 0.953125, + 0.9609375, + 0.9765625, + 0.9453125, + 0.9609375, + 0.9609375, + 0.9765625, + 0.984375, + 0.984375, + 0.9765625, + 0.96875, + 0.9921875, + 0.9453125, + 0.9765625, + 0.953125, + 0.984375, + 0.96875, + 0.9765625, + 0.984375, + 0.9921875, + 0.96875, + 0.9765625, + 0.9765625, + 0.953125, + 0.984375, + 0.9765625, + 0.984375, + 0.984375, + 1.0, + 0.96875, + 0.984375, + 0.984375, + 0.96875, + 0.9765625, + 0.9609375, + 0.984375, + 0.984375, + 0.984375, + 1.0, + 0.9765625, + 0.953125, + 0.9765625, + 0.9609375, + 0.96875, + 0.9765625, + 0.9765625, + 0.984375, + 0.9921875, + 0.9609375, + 0.9921875, + 0.96875, + 0.9609375, + 0.9765625, + 1.0, + 0.953125, + 0.9921875, + ], + "top3": [ + 0.80078125, + 0.890625, + 0.93359375, + 0.96484375, + 0.984375, + 0.9765625, + 1.0, + 1.0, + 0.9921875, + 0.984375, + 0.984375, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 0.9921875, + 0.9921875, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 0.984375, + 1.0, + 1.0, + 1.0, + 0.9921875, + 1.0, + 0.984375, + 1.0, + 1.0, + 1.0, + 0.9921875, + 0.984375, + 1.0, + 1.0, + 1.0, + 1.0, + 0.9921875, + 0.9921875, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 0.984375, + 0.9765625, + 0.9921875, + 1.0, + 1.0, + 1.0, + 0.9921875, + 1.0, + 1.0, + 0.9921875, + 0.9921875, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.9921875, + 0.9921875, + 0.9921875, + 1.0, + 1.0, + 0.9921875, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.984375, + 0.9921875, + 1.0, + 1.0, + 0.9921875, + 1.0, + 0.9921875, + 1.0, + ], + }, + "val": { + "top1": [ + 0.19500000029802322, + 0.22111110389232635, + 0.2266666665673256, + 0.22972221672534943, + 0.22083333134651184, + 0.24166665971279144, + 0.2522222101688385, + 0.25, + 0.24666666984558105, + 0.24666666984558105, + 0.24611110985279083, + 0.25, + 0.2455555498600006, + 0.24500000476837158, + 0.24722221493721008, + 0.2516666650772095, + 0.24944444000720978, + 0.2405555546283722, + 0.24888889491558075, + 0.2549999952316284, + 0.2544444501399994, + 0.24500000476837158, + 0.24666666984558105, + 0.25055554509162903, + 0.2516666650772095, + 0.24944444000720978, + 0.24444444477558136, + 0.24944444000720978, + 0.2544444501399994, + 0.25, + 0.2594444453716278, + 0.2522222101688385, + 0.25611111521720886, + 0.24611110985279083, + 0.25611111521720886, + 0.2566666603088379, + 0.25333333015441895, + 0.25833332538604736, + 0.25777778029441833, + 0.25333333015441895, + 0.24944444000720978, + 0.2477777749300003, + 0.24722221493721008, + 0.253888875246048, + 0.2516666650772095, + 0.24944444000720978, + 0.24611110985279083, + 0.24722221493721008, + 0.24944444000720978, + 0.2527777850627899, + 0.25, + 0.2522222101688385, + 0.2527777850627899, + 0.24388888478279114, + 0.24500000476837158, + 0.2527777850627899, + 0.2522222101688385, + 0.2477777749300003, + 0.24944444000720978, + 0.2522222101688385, + 0.2527777850627899, + 0.2433333396911621, + 0.24833333492279053, + 0.2477777749300003, + 0.2383333295583725, + 0.2516666650772095, + 0.2522222101688385, + 0.25999999046325684, + 0.2544444501399994, + 0.25, + 0.253888875246048, + 0.2588889002799988, + 0.25333333015441895, + 0.2516666650772095, + 0.25777778029441833, + 0.24944444000720978, + 0.2527777850627899, + 0.24833333492279053, + 0.2588889002799988, + 0.25111111998558044, + 0.2522222101688385, + 0.25555557012557983, + 0.253888875246048, + 0.25555557012557983, + 0.24611110985279083, + 0.25111111998558044, + 0.25999999046325684, + 0.2611111104488373, + 0.26055556535720825, + 0.25555557012557983, + 0.24666666984558105, + 0.2477777749300003, + 0.2522222101688385, + 0.2544444501399994, + 0.25611111521720886, + 0.25111111998558044, + 0.25833332538604736, + 0.25611111521720886, + 0.25833332538604736, + 0.25611111521720886, + ], + "top3": [ + 0.4186111092567444, + 0.449444442987442, + 0.4577777683734894, + 0.45444443821907043, + 0.45694443583488464, + 0.476666659116745, + 0.4694444537162781, + 0.4744444489479065, + 0.48055556416511536, + 0.48055556416511536, + 0.4744444489479065, + 0.46666666865348816, + 0.4716666638851166, + 0.46888887882232666, + 0.4744444489479065, + 0.47611111402511597, + 0.4772222340106964, + 0.48055556416511536, + 0.47555556893348694, + 0.47611111402511597, + 0.472777783870697, + 0.47777777910232544, + 0.47333332896232605, + 0.476666659116745, + 0.4749999940395355, + 0.4722222089767456, + 0.4694444537162781, + 0.4877777695655823, + 0.4772222340106964, + 0.4694444537162781, + 0.47777777910232544, + 0.48444443941116333, + 0.4838888943195343, + 0.4788888990879059, + 0.4833333194255829, + 0.4877777695655823, + 0.48444443941116333, + 0.47999998927116394, + 0.49444442987442017, + 0.49000000953674316, + 0.4816666543483734, + 0.4749999940395355, + 0.47833332419395447, + 0.4716666638851166, + 0.4866666793823242, + 0.47833332419395447, + 0.48222222924232483, + 0.4833333194255829, + 0.48277777433395386, + 0.4972222149372101, + 0.4816666543483734, + 0.4866666793823242, + 0.47777777910232544, + 0.47999998927116394, + 0.472777783870697, + 0.48222222924232483, + 0.4866666793823242, + 0.476666659116745, + 0.4855555593967438, + 0.48055556416511536, + 0.4833333194255829, + 0.476666659116745, + 0.48222222924232483, + 0.4833333194255829, + 0.4794444441795349, + 0.4816666543483734, + 0.4833333194255829, + 0.47555556893348694, + 0.48277777433395386, + 0.47833332419395447, + 0.48500001430511475, + 0.4749999940395355, + 0.48055556416511536, + 0.47055554389953613, + 0.47833332419395447, + 0.4744444489479065, + 0.48444443941116333, + 0.4816666543483734, + 0.476666659116745, + 0.49000000953674316, + 0.47833332419395447, + 0.4794444441795349, + 0.4811111092567444, + 0.4749999940395355, + 0.47777777910232544, + 0.4866666793823242, + 0.47777777910232544, + 0.48444443941116333, + 0.4877777695655823, + 0.4811111092567444, + 0.48222222924232483, + 0.48500001430511475, + 0.4816666543483734, + 0.4833333194255829, + 0.48444443941116333, + 0.48944443464279175, + 0.49000000953674316, + 0.4883333444595337, + 0.48944443464279175, + 0.48500001430511475, + ], + }, +} + +with open("/home/laurent/Documents/Cours/ENSEEIHT/S9 - IAM/Projet/src/recup_baseline.txt", "r") as file: + for line in file: + matches = re.finditer(r"(val_loss|loss): ([0-9.]+)", line) + for match in matches: + metric_name = match.group(1) + metric_value = float(match.group(2)) + h1[metric_name].append(metric_value) + +# with open("/home/laurent/Documents/Cours/ENSEEIHT/S9 - IAM/Projet/src/recup_semisup.txt", "r") as file: +# for line in file: +# matches = re.finditer(r"(val_top1|val_top3): ([0-9.]+)", line) +# for match in matches: +# metric_name = match.group(1) +# metric_value = float(match.group(2)) +# h2[metric_name].append(metric_value) + +# with open("/home/laurent/Documents/Cours/ENSEEIHT/S9 - IAM/Projet/src/recup_finetuning.txt", "r") as file: +# for line in file: +# matches = re.finditer(r"(val_top1|val_top3): ([0-9.]+)", line) +# for match in matches: +# metric_name = match.group(1) +# metric_value = float(match.group(2)) +# h3[metric_name].append(metric_value) + +# plt.figure(figsize=(15, 10)) +# plt.plot(d1["val"]["top1"], label="baseline_val_top1") +# # plt.plot(h1["val_top3"], color="green", label="baseline_top3") +# plt.plot(d2["val"]["top1"], label="semisup_val_top1") +# # plt.plot(h2["val_top3"], color="green", label="semisup_top3") +# plt.plot(d3["val"]["top1"], label="pretrain_val_top1") +# # plt.plot(h3["val_top3"], color="green", label="finetuning_top3") +# plt.xlabel("Epochs") +# plt.ylabel("Accuracy") +# plt.legend() +# plt.grid() +# plt.savefig("comp_accuracy_sgan.png", dpi=300, transparent=True, bbox_inches="tight", pad_inches=0) + +plt.figure(figsize=(15, 10)) +plt.plot(h1["loss"], color="purple", label="loss") +plt.plot(h1["val_loss"], color="purple", label="val_loss", linestyle="--") +plt.ylabel("Loss") +plt.xlabel("Epochs") +plt.legend() +plt.grid() +plt.savefig("baseline_loss_simclr.png", dpi=300, transparent=True, bbox_inches="tight", pad_inches=0)