Update README.md
Browse files
README.md
CHANGED
@@ -36,14 +36,7 @@ ___
|
|
36 |
</a>
|
37 |
</div>
|
38 |
|
39 |
-
```python
|
40 |
-
from Charm_tokenizer.ImageProcessor import Charm_Tokenizer
|
41 |
-
|
42 |
-
img_path = r"img.png"
|
43 |
|
44 |
-
charm_tokenizer = Charm_Tokenizer(patch_selection='frequency', training_dataset='tad66k', without_pad_or_dropping=True)
|
45 |
-
tokens, pos_embed, mask_token = charm_tokenizer.preprocess(img_path)
|
46 |
-
```
|
47 |
Charm Tokenizer has the following input args:
|
48 |
* patch_selection (str): The method for selecting important patches
|
49 |
* Options: 'saliency', 'random', 'frequency', 'gradient', 'entropy', 'original'.
|
@@ -57,11 +50,29 @@ Charm Tokenizer has the following input args:
|
|
57 |
* downscale_shortest_edge (int): Used for the 'original' patch selection strategy (default: 256).
|
58 |
* without_pad_or_dropping (bool): Whether to avoid padding or dropping patches (default: True).
|
59 |
|
|
|
|
|
60 |
The output is the preprocessed tokens, their corresponding positional embeddings, and a mask token that indicates which patches are in high resolution and which are in low resolution.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
___
|
62 |
|
63 |
* Step 4) Predicting aesthetic/quality score
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
```python
|
66 |
from Charm_tokenizer.Backbone import backbone
|
67 |
|
@@ -69,6 +80,4 @@ model = backbone(training_dataset='tad66k', device='cpu')
|
|
69 |
prediction = model.predict(tokens, pos_embed, mask_token)
|
70 |
```
|
71 |
|
72 |
-
**Note:**
|
73 |
-
1. While random patch selection during training helps avoid overfitting,for consistent results during inference, fully deterministic patch selection approaches should be used.
|
74 |
-
2. For the training code, check our [GitHub Page](https://github.com/FBehrad/Charm/).
|
|
|
36 |
</a>
|
37 |
</div>
|
38 |
|
|
|
|
|
|
|
|
|
39 |
|
|
|
|
|
|
|
40 |
Charm Tokenizer has the following input args:
|
41 |
* patch_selection (str): The method for selecting important patches
|
42 |
* Options: 'saliency', 'random', 'frequency', 'gradient', 'entropy', 'original'.
|
|
|
50 |
* downscale_shortest_edge (int): Used for the 'original' patch selection strategy (default: 256).
|
51 |
* without_pad_or_dropping (bool): Whether to avoid padding or dropping patches (default: True).
|
52 |
|
53 |
+
**Note:** While random patch selection during training helps avoid overfitting,for consistent results during inference, fully deterministic patch selection approaches should be used.
|
54 |
+
|
55 |
The output is the preprocessed tokens, their corresponding positional embeddings, and a mask token that indicates which patches are in high resolution and which are in low resolution.
|
56 |
+
|
57 |
+
```python
|
58 |
+
from Charm_tokenizer.ImageProcessor import Charm_Tokenizer
|
59 |
+
|
60 |
+
img_path = r"img.png"
|
61 |
+
|
62 |
+
charm_tokenizer = Charm_Tokenizer(patch_selection='frequency', training_dataset='tad66k', without_pad_or_dropping=True)
|
63 |
+
tokens, pos_embed, mask_token = charm_tokenizer.preprocess(img_path)
|
64 |
+
```
|
65 |
___
|
66 |
|
67 |
* Step 4) Predicting aesthetic/quality score
|
68 |
|
69 |
+
* If training_dataset is set to 'spaq' or 'koniq10k', the model predicts the image quality score. For other options ('aadb', 'tad66k', 'para', 'baid'), it predicts the image aesthetic score.
|
70 |
+
|
71 |
+
* Selecting a dataset with image resolutions similar to your input images can improve prediction accuracy.
|
72 |
+
|
73 |
+
* For more details about the process, please refer to the [paper](https://cvpr.thecvf.com/virtual/2025/poster/34423).
|
74 |
+
|
75 |
+
|
76 |
```python
|
77 |
from Charm_tokenizer.Backbone import backbone
|
78 |
|
|
|
80 |
prediction = model.predict(tokens, pos_embed, mask_token)
|
81 |
```
|
82 |
|
83 |
+
**Note:** For the training code, check our [GitHub Page](https://github.com/FBehrad/Charm/).
|
|
|
|