Skip to content

Commit 468c08a

Browse files
authored
Create README.md
1 parent 80b7b61 commit 468c08a

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Image Recognition
2+
![alt text](https://github.com/Null-byte-00/Imagerecognition/blob/main/imagerec.gif)
3+
A simple Image recognition program using pytorch
4+
This is a simple convolutional neural network capable of recognizing 3 different shapes (house, smiling face and fish)<br>
5+
[you can download full version from here](https://drive.google.com/file/d/1CN_dbHrfiZctm-eJKfEIBof6HHYs1SjA/view?usp=drive_link)
6+
## The model
7+
the model is a a small convolutional neural network with two convolution/maxpool and 2 linear layers. the input is a square 500x500 2d array (because all pixels in my datase images are whether (0,0,0) or (255,255,255) it shoul be
8+
a 2d array of 0s and 1s). It gives 3 different numbers as output that are then passed through a softmax function to get the probabilities for 3 different shapes
9+
## The dataset
10+
the dataset consists of 243 pictures I drew (81 samples for each shape)<br>
11+
create_dataset.py turns all thesepictures intoa hdf file<br>
12+
[here you can download raw images](https://drive.google.com/file/d/1k1mj3IhPsY-ZmQHdGsiiAwm3iMY7Zt4R/view?usp=drive_link)
13+
## Training
14+
the model is trained by stochastic gradient descent and mean square error loss function.<br>
15+
[here you can download the trained model pth file]()
16+
## how to use
17+
first import the conda enviroment
18+
```
19+
conda env create -f environment.yml
20+
```
21+
activate the enviroment
22+
```
23+
conda activate imagerecognition
24+
```
25+
create a directory named models then download the trained model from [here](https://drive.google.com/file/d/15cgj57P1yLuC7fwWc9u_2omlSK4DFuKl/view?usp=drive_link) and copy it in models directory
26+
now run:
27+
```
28+
python main.py
29+
```
30+
the window will open and you can draw. press 'c' on the keyboard to get the results like this:
31+
```
32+
tensor([-160.3708, 134.9981, 40.6356])
33+
house: tensor(0., grad_fn=<MulBackward0>)
34+
smilingface: tensor(100., grad_fn=<MulBackward0>)
35+
fish: tensor(1.0445e-39, grad_fn=<MulBackward0>)
36+
```
37+
these are probability percentages for each shape

0 commit comments

Comments
 (0)