From b99b49b19cdb54490458696c8e97078ea174010c Mon Sep 17 00:00:00 2001 From: maksymshylo Date: Wed, 15 Apr 2026 11:00:08 +0200 Subject: [PATCH 1/4] update README --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2d2f62a..e7f2a91 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # Pattern Recognition **Table of contents** -- [Decoding of a noised number](#lab-1--decoding-of-a-noised-number) -- [Risk minimization](#lab-2--risk-minimization) -- [Risk minimization](#lab-3--risk-minimization) + +- [Acknowledgements](#acknowledgements) +- [Setup](#setup) +- [Decoding of a noisy number](#lab-1--decoding-of-a-noisy-number) +- [Risk minimization (interval loss function)](#lab-2--risk-minimization-interval-loss-function) +- [Risk minimization (l1 loss function)](#lab-3--risk-minimization-l1-loss-function) - [Analysis of Nonbayesian Strategy](#lab-4--analysis-of-nonbayesian-strategy) - [Efficient computation of a sum of a subarray in 1D](#lab-5--efficient-computation-of-a-sum-of-a-subarray-in-1d-2d-and-3d) - [Divisibility sum of digits](#lab-6--divisibility-sum-of-digits) @@ -16,10 +19,50 @@ - [solutions.pdf](`all-labs.pdf`) - [tasks.pdf](`tasks.pdf`) -## Lab 1 – Decoding of a noised number +## Acknowledgements + +We would like to express our sincere gratitude to the course instructor, +**Valerii Krygin**, +for the tremendous effort, dedication, and passion invested in teaching 📚 this course. +His commitment to delivering high-quality material and supporting students throughout +the learning process has been truly invaluable. + +This course laid the foundation for our understanding of Python programming 🐍 and the +fundamentals of computer vision 👁️🖥️, opening the door to further growth in these fields. + +We are grateful for the patience, guidance, and encouragement provided along +the way when our code was full of bugs and errors . + +We will always remember the many sleepless hours 😵‍💫 it required- +and even more so, the lasting value, skills, and mindset it has given us for the future 🚀. + + + +## Setup + +To run these applications, you need to have **Python3.12**. + +1. Clone repo. + +2. Create virtual environment. +```bash +python3.12 -m venv .venv +``` + +3. Activate it +```bash +source .venv/bin/activate +``` + +4. Install requirements: +```bash +pip install -r requirements.txt +``` + +## Lab 1 – Decoding of a noisy number ### Description -The program converts a number to a noised (bernoulli noise) image and then decodes it. +The program converts a number to a noisy (bernoulli noise) image and then decodes it. Bayesian strategy for a binary loss function is used. ### Usage @@ -51,12 +94,12 @@ Time: 0.022138417001769994 sec Decoded number: 9 ``` -| Original image | Noised image | Decoded number | +| Original image | Noisy image | Decoded number | |----------------------------------|:------------------------------------------:|----------------| | ![](.imgs/lab1/number_img.png) | ![](.imgs/lab1/number_img_noised_0.56.png) | 9 | -## Lab 2 – Risk minimization +## Lab 2 – Risk minimization (interval loss function) ### Description Bayesian strategy for **interval** loss function is used. @@ -83,7 +126,7 @@ Heatmap normalized: [0.10251256 0.1798995 0.09246231 0.01407035 0.10653266 0.0 Result: 4 ``` -## Lab 3 – Risk minimization +## Lab 3 – Risk minimization (L1 loss function) ### Description Bayesian strategy for **L1** loss function is used. @@ -199,7 +242,7 @@ Success divisions: 2/5 time : 0.018097166999723413 sec ``` -| Image | Noised Image | +| Image | Noisy Image | |----------------------------------------|:-------------------------------------------------------:| | ![](.imgs/lab6/digits_img__iter_0.png) | ![](.imgs/lab6/digits_img_noised__iter_0_div_True.png) | | ![](.imgs/lab6/digits_img__iter_1.png) | ![](.imgs/lab6/digits_img_noised__iter_1_div_False.png) | @@ -271,7 +314,7 @@ Testing on 3893 samples... Test set accuracy: 0.9604 ``` -## Kab 9 - Finding the separating circle +## Lab 9 – Finding the separating circle ### Description Modification of Perceptron Algorithm where hyperplane is a circle (modified scalar product). @@ -296,4 +339,9 @@ $ python3 perceptron_circle.py --n 300 --seed 31 Original: a=0, b=8, r=9 Predicted: a=0.261, b=8.462, r=8.711 ``` -![](.imgs/lab9/Figure_1.png) \ No newline at end of file +![](.imgs/lab9/Figure_1.png) + +## Authors + +- Maksym Shylo +- Ruslan Khomenko \ No newline at end of file From 35fae13e9377d67148ff6d36ca1565b92dc227f0 Mon Sep 17 00:00:00 2001 From: maksymshylo Date: Fri, 17 Apr 2026 09:29:20 +0200 Subject: [PATCH 2/4] add LICENSE, improve README --- LICENSE | 21 ++++++++++++++++ README.md | 72 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ef2938b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2020] [Maksym Shylo and Ruslan Khomenko] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index e7f2a91..7cd809b 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,29 @@ **Table of contents** -- [Acknowledgements](#acknowledgements) -- [Setup](#setup) -- [Decoding of a noisy number](#lab-1--decoding-of-a-noisy-number) -- [Risk minimization (interval loss function)](#lab-2--risk-minimization-interval-loss-function) -- [Risk minimization (l1 loss function)](#lab-3--risk-minimization-l1-loss-function) -- [Analysis of Nonbayesian Strategy](#lab-4--analysis-of-nonbayesian-strategy) -- [Efficient computation of a sum of a subarray in 1D](#lab-5--efficient-computation-of-a-sum-of-a-subarray-in-1d-2d-and-3d) -- [Divisibility sum of digits](#lab-6--divisibility-sum-of-digits) -- [Binocular stereo vision](#lab-7--binocular-stereo-vision) -- [Binary Clustering](#lab-8--binary-clustering) -- [Finding the separating circle](#lab-9--finding-the-separating-circle) +- [Lab 1. Decoding of a noisy number](#lab-1--decoding-of-a-noisy-number) +- [Lab 2. Risk minimization (interval loss function)](#lab-2--risk-minimization-interval-loss-function) +- [Lab 3. Risk minimization (l1 loss function)](#lab-3--risk-minimization-l1-loss-function) +- [Lab 4. Analysis of Nonbayesian Strategy](#lab-4--analysis-of-nonbayesian-strategy) +- [Lab 5. Efficient computation of a sum of a subarray in 1D, 2D, 3D](#lab-5--efficient-computation-of-a-sum-of-a-subarray-in-1d-2d-and-3d) +- [Lab 6. Divisibility sum of digits](#lab-6--divisibility-sum-of-digits) +- [Lab 7. Binocular stereo vision](#lab-7--binocular-stereo-vision) +- [Lab 8. Binary Clustering](#lab-8--binary-clustering) +- [Lab 9. Finding the separating circle](#lab-9--finding-the-separating-circle) **Tasks and mathematical solutions** -- [solutions.pdf](`all-labs.pdf`) -- [tasks.pdf](`tasks.pdf`) +- [solutions.pdf](solutions.pdf). +- [tasks.pdf](tasks.pdf); + +The tasks document is the +intellectual property of Valerii Krygin (@definability) and +is included in this repository with explicit permission. ## Acknowledgements We would like to express our sincere gratitude to the course instructor, -**Valerii Krygin**, +Valerii Krygin (@definability), for the tremendous effort, dedication, and passion invested in teaching 📚 this course. His commitment to delivering high-quality material and supporting students throughout the learning process has been truly invaluable. @@ -30,10 +32,7 @@ the learning process has been truly invaluable. This course laid the foundation for our understanding of Python programming 🐍 and the fundamentals of computer vision 👁️🖥️, opening the door to further growth in these fields. -We are grateful for the patience, guidance, and encouragement provided along -the way when our code was full of bugs and errors . - -We will always remember the many sleepless hours 😵‍💫 it required- +We will always remember the sleepless nights 😵‍💫 it required- and even more so, the lasting value, skills, and mindset it has given us for the future 🚀. @@ -45,24 +44,24 @@ To run these applications, you need to have **Python3.12**. 1. Clone repo. 2. Create virtual environment. -```bash -python3.12 -m venv .venv -``` + ```bash + python3.12 -m venv .venv + ``` 3. Activate it -```bash -source .venv/bin/activate -``` + ```bash + source .venv/bin/activate + ``` 4. Install requirements: -```bash -pip install -r requirements.txt -``` + ```bash + pip install -r requirements.txt + ``` ## Lab 1 – Decoding of a noisy number ### Description -The program converts a number to a noisy (bernoulli noise) image and then decodes it. +The program converts a number to a noisy (Bernoulli noise) image and then decodes it. Bayesian strategy for a binary loss function is used. ### Usage @@ -200,7 +199,7 @@ $ python subsum.py | ![](.imgs/lab5/benchmark_numpy.png) | ![](.imgs/lab5/benchmark_prefix.png) | -## Lab 6 – Divisibility sum of digits +## Lab 6 – Divisibility sum of digits ### Description The program generates a number image and then apply noise and checks whether it is divisible by a given number. @@ -275,11 +274,14 @@ options: python3 stereo.py --left examples/im2.ppm --right examples/im5.ppm --alpha 10 --maxd 50 ``` -| Left Image | Right Image | Disparity Map | -|-----------------------------------|-------------------------|:-------------------------------------------------------:| -| ![](.imgs/lab7/im2.png) | ![](.imgs/lab7/im5.png) | ![](.imgs/lab7/disparity_map.png) | +| Left Image | Right Image | Disparity Map | +|-----------------------------|-------------------------|:------------------------------------:| +| ![](.imgs/lab7/im2.png) | ![](.imgs/lab7/im5.png) | ![](.imgs/lab7/disparity_map.png) | -Images - http://vision.middlebury.edu/stereo/data/ +[Images](http://vision.middlebury.edu/stereo/data/): +D. Scharstein and R. Szeliski. A taxonomy and evaluation of dense two-frame +stereo correspondence algorithms. +International Journal of Computer Vision, 47(1/2/3):7-42, April-June 2002. ## Lab 8 – Binary Clustering @@ -343,5 +345,5 @@ Predicted: a=0.261, b=8.462, r=8.711 ## Authors -- Maksym Shylo -- Ruslan Khomenko \ No newline at end of file +- Maksym Shylo (@maksymshylo) +- Ruslan Khomenko (@Ruslan3584) From aa24e5c2bde4e813c8279d4d2baccd895dfed8c7 Mon Sep 17 00:00:00 2001 From: maksymshylo Date: Fri, 17 Apr 2026 10:09:25 +0200 Subject: [PATCH 3/4] fix links --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7cd809b..63da4cf 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ - [tasks.pdf](tasks.pdf); The tasks document is the -intellectual property of Valerii Krygin (@definability) and +intellectual property of [Valerii Krygin](https://github.com/definability) and is included in this repository with explicit permission. ## Acknowledgements We would like to express our sincere gratitude to the course instructor, -Valerii Krygin (@definability), +[Valerii Krygin](https://github.com/definability), for the tremendous effort, dedication, and passion invested in teaching 📚 this course. His commitment to delivering high-quality material and supporting students throughout the learning process has been truly invaluable. @@ -345,5 +345,5 @@ Predicted: a=0.261, b=8.462, r=8.711 ## Authors -- Maksym Shylo (@maksymshylo) -- Ruslan Khomenko (@Ruslan3584) +- [Maksym Shylo](https://github.com/maksymshylo) +- [Ruslan Khomenko](https://github.com/Ruslan3584) From 28bd0fce860e5855dd92df16baec10901da2874a Mon Sep 17 00:00:00 2001 From: maksymshylo Date: Fri, 17 Apr 2026 10:21:02 +0200 Subject: [PATCH 4/4] fix links again --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 63da4cf..60469dc 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,13 @@ - [tasks.pdf](tasks.pdf); The tasks document is the -intellectual property of [Valerii Krygin](https://github.com/definability) and +intellectual property of Valerii Krygin ([definability](https://github.com/definability)) and is included in this repository with explicit permission. ## Acknowledgements We would like to express our sincere gratitude to the course instructor, -[Valerii Krygin](https://github.com/definability), +Valerii Krygin ([definability](https://github.com/definability)), for the tremendous effort, dedication, and passion invested in teaching 📚 this course. His commitment to delivering high-quality material and supporting students throughout the learning process has been truly invaluable. @@ -345,5 +345,5 @@ Predicted: a=0.261, b=8.462, r=8.711 ## Authors -- [Maksym Shylo](https://github.com/maksymshylo) -- [Ruslan Khomenko](https://github.com/Ruslan3584) +- Maksym Shylo ([maksymshylo](https://github.com/maksymshylo)) +- Ruslan Khomenko ([Ruslan3584](https://github.com/Ruslan3584))