Ajibola commited on
Commit
41c67ea
·
1 Parent(s): 20828c9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md CHANGED
@@ -1,3 +1,56 @@
1
  ---
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
  ---
4
+ <h1>README for Pathway Vision Transformer</h1><br>
5
+
6
+
7
+ <p>PaViT is a Pathway Vision Transformer (PaViT)-based image recognition model developed by Ajibola Emmanuel Oluwaseun. The model is inspired by Google's PaLM (Pathways Language Model) and aims to demonstrate the potential of using few-shot learning techniques in image recognition tasks.</p>
8
+
9
+ <h1>Model Performance</h1>
10
+ PaViT was trained on a 4GB RAM CPU using a dataset of 15000 Kaggle images of 15 classes, achieving a remarkable 88% accuracy with 4 self-attention heads. The model's accuracy further improved to 96% when trained with 12 self-attention heads and 12 linearly stacked linear layers. These results demonstrate the model's impressive performance and fast training speed on a CPU, despite being trained on a relatively small dataset.
11
+
12
+ <h1>Usage</h1>
13
+ The model can be used for image recognition tasks by using the trained weights provided in the repository. The code can be modified to use custom datasets, and the model's performance can be further improved by adding more self-attention heads and linear layers.
14
+
15
+ <h1>Contribution</h1>
16
+ The author believes that PaViT has the potential to outperform existing Vision Transformer models and is eager to see it continue to evolve through the contributions of developers and other contributors.
17
+ <br></br>
18
+ Contributions to the project are welcome and can be made through pull requests. Developers can also report issues or suggest new features for the project.
19
+
20
+ <h1>License</h1>
21
+ This project is licensed under the MIT License.
22
+
23
+
24
+ <h1>How to use:</h1>
25
+ <br>
26
+ On inference</br>
27
+
28
+ ```ruby
29
+ import PaViT
30
+ import cv2
31
+ from tensorflow.keras.models import *
32
+ image=cv2.imread(image) #Load image
33
+ image=cv2.cvtColor(image, cv2.COLOR_BGR2RGB) #Convert image to RGB
34
+ image=cv2.resize(224, 224) #Default image size
35
+ model=load_model('trained_weight.h5') #Load weight
36
+ prediction=model.predict(image) #run inference
37
+ prediction=np.argmax(prediction, axis=-1) #Show highest probability class
38
+ ```
39
+ <br>On Training</br>
40
+ ```ruby
41
+ model=PaViT.PaViT()
42
+ #Output means the unit default is 15 and activation 'sigmoid'
43
+ #Output_class default is None so it uses Dense layer as the output_layer
44
+ #Ouptut_class is the output layer
45
+ p_model=model.model(output_class=None, activation='softmax', output=15)
46
+ p_model.summary()
47
+ p_model.compile(...)
48
+ p_model.fit(...)
49
+
50
+ ```
51
+
52
+ <h1>Prediction on Test data</h1>
53
+ <img src='https://github.com/AjibolaPy/PaViT/blob/main/test.png' alt='test image'>
54
+
55
+
56
+