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 2d2f62a..60469dc 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,67 @@ # 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) -- [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](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](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. + +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 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 🚀. + + + +## Setup -## Lab 1 – Decoding of a noised number +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 +93,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 +125,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. @@ -157,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. @@ -199,7 +241,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) | @@ -232,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 @@ -271,7 +316,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 +341,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 ([maksymshylo](https://github.com/maksymshylo)) +- Ruslan Khomenko ([Ruslan3584](https://github.com/Ruslan3584))