KPLabs commited on
Commit
f6022d4
·
verified ·
1 Parent(s): c5d8dc0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -3
README.md CHANGED
@@ -1,3 +1,46 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+
5
+ # HYPERVIEW - Vision Transformer Model (https://ai4eo.eu/challenge/hyperview-challenge/):
6
+
7
+ This repository is based on the original code from:
8
+
9
+ [ridvansalihkuzu/hyperview_eagleeyes (experimental_1 branch)]:
10
+
11
+ https://github.com/ridvansalihkuzu/hyperview_eagleeyes/tree/master/experimental_1
12
+
13
+ Below are the instructions to set up the environment and run the code:
14
+
15
+ ## Table of Contents
16
+
17
+ - [Setup and Usage](#setup-and-usage)
18
+ - [Loading the Pre-Trained Model](#loading-the-pre-trained-model)
19
+ - [Loading the Training Data](#loading-the-training-data)
20
+ - [Code Modifications](#code-modifications)
21
+ - [Environment Setup](#environment-setup)
22
+
23
+ ## Setup and Usage
24
+
25
+ ### Loading the Pre-Trained Model
26
+
27
+ To load a pre-trained model ("VisionTransformer.pt"), use the following code snippet:
28
+
29
+ ```python
30
+ import clip
31
+ from clip.downstream_task import TaskType
32
+ import torch # Make sure to import torch
33
+
34
+ device = "cpu" # Change to 'cuda' if you have a GPU
35
+ num_classes = 4 # Number of classes in the original HYPERVIEW dataset
36
+
37
+ # Load the CLIP model with the downstream task configuration
38
+ model, _ = clip.load(
39
+ "ViT-L/14", device, downstream_task=TaskType.HYPERVIEW,
40
+ class_num=num_classes
41
+ )
42
+
43
+ # Load the pre-trained weights
44
+ model.load_state_dict(torch.load("VisionTransformer.pt"))
45
+ model.eval() # Set the model to evaluation mode
46
+ ```