File size: 2,279 Bytes
3179785
 
 
 
 
e174432
 
3179785
 
 
e174432
3179785
 
 
4419fe9
e682ae0
5aff428
896a92c
e9837c9
9a6de96
 
2b3e598
9a6de96
 
2e9199e
e9837c9
8ab52f7
13505e1
 
4e8bca1
45218ae
8ab52f7
4e8bca1
8ab52f7
82c2b3e
441d9c2
bd08559
45218ae
194786a
 
4419fe9
 
4a218f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4419fe9
 
 
 
 
 
 
 
194786a
081442c
14eb54e
081442c
 
 
 
 
 
 
 
 
 
 
727da8d
081442c
 
 
50188f8
14eb54e
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
license: apache-2.0
base_model: google/vit-base-patch16-224
tags:
- Image Regression
datasets:
- "-"
metrics:
- accuracy
model-index:
- name: "-"
  results: []
---

# Title
## Image Regression Model

This model was trained with [Image Regression Model Trainer](https://github.com/TonyAssi/ImageRegression/tree/main). It takes an image as input and outputs a float value.

```python
from ImageRegression import predict
predict(repo_id='-',image_path='image.jpg')
```

---

## Dataset
Dataset:\
Value Column:\
Train Test Split:

---

## Training
Base Model: [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224)\
Epochs:\
Learning Rate:

---

## Usage

### Download
```bash
git clone https://github.com/TonyAssi/ImageRegression.git
cd ImageRegression
```

### Installation
```bash
pip install -r requirements.txt
```

### Import 
```python
from ImageRegression import train_model, upload_model, predict
```

### Inference (Prediction)
- **repo_id** 🤗 repo id of the model
- **image_path** path to image
```python
predict(repo_id='-',
        image_path='image.jpg')
```
The first time this function is called it'll download the safetensor model. Subsequent function calls will run faster.

### Train Model
- **dataset_id** 🤗 dataset id
- **value_column_name** column name of prediction values in dataset
- **test_split** test split of the train/test split
- **output_dir** the directory where the checkpoints will be saved
- **num_train_epochs** training epochs
- **learning_rate** learning rate
```python
train_model(dataset_id='-',
            value_column_name='-',
            test_split=-,
            output_dir='./results',
            num_train_epochs=-,
            learning_rate=1e-)

```
The trainer will save the checkpoints in the output_dir location. The model.safetensors are the trained weights you'll use for inference (predicton).

### Upload Model
This function will upload your model to the 🤗 Hub.
- **model_id** the name of the model id
- **token** go [here](https://huggingface.co/settings/tokens) to create a new 🤗 token
- **checkpoint_dir** checkpoint folder that will be uploaded
```python
upload_model(model_id='-',
             token='YOUR_HF_TOKEN',
             checkpoint_dir='./results/checkpoint-940')
```