where to download training data and checkpoints
Browse files- .gitignore +1 -0
- README.md +15 -1
- script/hyperparameter_tuning.py +7 -7
- script/train.py +21 -47
- script/visualization/visualize.py +4 -6
- script/visualization/viz_cross_compare.py +4 -4
.gitignore
CHANGED
|
@@ -38,6 +38,7 @@ runs/
|
|
| 38 |
outputs/
|
| 39 |
runs_hyperparam/
|
| 40 |
checkpoints/
|
|
|
|
| 41 |
*.pth
|
| 42 |
*.ckpt
|
| 43 |
*.pt
|
|
|
|
| 38 |
outputs/
|
| 39 |
runs_hyperparam/
|
| 40 |
checkpoints/
|
| 41 |
+
data/
|
| 42 |
*.pth
|
| 43 |
*.ckpt
|
| 44 |
*.pt
|
README.md
CHANGED
|
@@ -24,13 +24,19 @@ chmod +x /usr/local/bin/cog
|
|
| 24 |
|
| 25 |
## Cog
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
build the image
|
| 28 |
|
| 29 |
```bash
|
| 30 |
cog build --separate-weights
|
| 31 |
```
|
| 32 |
|
| 33 |
-
push
|
| 34 |
|
| 35 |
```bash
|
| 36 |
cog push
|
|
@@ -82,6 +88,14 @@ clip/
|
|
| 82 |
└── requirements.txt # Python dependencies
|
| 83 |
```
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
## Model Architecture
|
| 86 |
|
| 87 |
- Base: CLIP ViT-Large/14
|
|
|
|
| 24 |
|
| 25 |
## Cog
|
| 26 |
|
| 27 |
+
download the weights
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
gdown https://drive.google.com/uc?id=1Gn3UdoKffKJwz84GnGx-WMFTwZuvDsuf -O ./checkpoints/
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
build the image
|
| 34 |
|
| 35 |
```bash
|
| 36 |
cog build --separate-weights
|
| 37 |
```
|
| 38 |
|
| 39 |
+
push a new image
|
| 40 |
|
| 41 |
```bash
|
| 42 |
cog push
|
|
|
|
| 88 |
└── requirements.txt # Python dependencies
|
| 89 |
```
|
| 90 |
|
| 91 |
+
## Training Data
|
| 92 |
+
|
| 93 |
+
To run training on your own, you can find the training data [here](https://drive.google.com/drive/folders/11M6nSuSuvoU2wpcV_-6KFqCzEMGP75q6?usp=drive_link) and put it in the a directory at the root of the project called `./data`.
|
| 94 |
+
|
| 95 |
+
## Checkpoints
|
| 96 |
+
|
| 97 |
+
To run predictions with cog or locally on an existing checkpoint, you can find a checkpoint and configuration files [here](https://drive.google.com/drive/folders/1Gn3UdoKffKJwz84GnGx-WMFTwZuvDsuf?usp=sharing) and put them in the a directory at the root of the project called `./checkpoints`.
|
| 98 |
+
|
| 99 |
## Model Architecture
|
| 100 |
|
| 101 |
- Base: CLIP ViT-Large/14
|
script/hyperparameter_tuning.py
CHANGED
|
@@ -227,13 +227,13 @@ def run_hyperparameter_search(data_paths, n_trials=100):
|
|
| 227 |
if __name__ == "__main__":
|
| 228 |
# List of dataset paths to optimize
|
| 229 |
data_paths = [
|
| 230 |
-
'
|
| 231 |
-
'
|
| 232 |
-
'
|
| 233 |
-
'
|
| 234 |
-
'
|
| 235 |
-
'
|
| 236 |
-
'
|
| 237 |
]
|
| 238 |
|
| 239 |
# Run hyperparameter search
|
|
|
|
| 227 |
if __name__ == "__main__":
|
| 228 |
# List of dataset paths to optimize
|
| 229 |
data_paths = [
|
| 230 |
+
'./data/blog/datasets/bryant/random',
|
| 231 |
+
'./data/blog/datasets/bryant/adjusted',
|
| 232 |
+
'./data/blog/datasets/youtube/random',
|
| 233 |
+
'./data/blog/datasets/youtube/adjusted',
|
| 234 |
+
'./data/blog/datasets/combined/random',
|
| 235 |
+
'./data/blog/datasets/combined/adjusted',
|
| 236 |
+
'./data/blog/datasets/bryant_train_youtube_val/default'
|
| 237 |
]
|
| 238 |
|
| 239 |
# Run hyperparameter search
|
script/train.py
CHANGED
|
@@ -273,56 +273,30 @@ def main():
|
|
| 273 |
config = {
|
| 274 |
"class_labels": class_labels,
|
| 275 |
"num_classes": len(class_labels),
|
| 276 |
-
"
|
| 277 |
-
"batch_size":
|
| 278 |
-
"
|
| 279 |
-
"
|
| 280 |
-
"
|
| 281 |
-
"
|
| 282 |
-
"
|
| 283 |
-
"
|
| 284 |
-
"max_frames": 15,
|
| 285 |
-
"sigma": 0.286510943464138,
|
| 286 |
-
"data_path": "../finetune/blog/bryant/random",
|
| 287 |
-
"num_epochs": 50,
|
| 288 |
-
"patience": 10,
|
| 289 |
"image_size": 224,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
"crop_scale_max": 1.0,
|
| 291 |
-
"normalization_mean": [
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
"
|
| 297 |
-
0.229,
|
| 298 |
-
0.224,
|
| 299 |
-
0.225
|
| 300 |
-
],
|
| 301 |
"overfitting_threshold": 10,
|
| 302 |
-
# "data_path": '../finetune/blog/bryant/random',
|
| 303 |
-
# "batch_size": 8,
|
| 304 |
-
# "learning_rate": 2e-6,
|
| 305 |
-
# "weight_decay": 0.007,
|
| 306 |
-
# "num_epochs": 2,
|
| 307 |
-
# "patience": 10, # for early stopping
|
| 308 |
-
# "max_frames": 10,
|
| 309 |
-
# "sigma": 0.3,
|
| 310 |
-
# "image_size": 224,
|
| 311 |
-
# "flip_probability": 0.5,
|
| 312 |
-
# "rotation_degrees": 15,
|
| 313 |
-
# "brightness_jitter": 0.2,
|
| 314 |
-
# "contrast_jitter": 0.2,
|
| 315 |
-
# "saturation_jitter": 0.2,
|
| 316 |
-
# "hue_jitter": 0.1,
|
| 317 |
-
# "crop_scale_min": 0.8,
|
| 318 |
-
# "crop_scale_max": 1.0,
|
| 319 |
-
# "normalization_mean": [0.485, 0.456, 0.406],
|
| 320 |
-
# "normalization_std": [0.229, 0.224, 0.225],
|
| 321 |
-
# "unfreeze_layers": 3,
|
| 322 |
-
# # "clip_model": "openai/clip-vit-large-patch14",
|
| 323 |
-
# "clip_model": "openai/clip-vit-base-patch32",
|
| 324 |
-
# "gradient_clip_max_norm": 1.0,
|
| 325 |
-
# "overfitting_threshold": 10,
|
| 326 |
"run_dir": run_dir,
|
| 327 |
}
|
| 328 |
train_and_evaluate(config)
|
|
|
|
| 273 |
config = {
|
| 274 |
"class_labels": class_labels,
|
| 275 |
"num_classes": len(class_labels),
|
| 276 |
+
"data_path": './data/blog/datasets/bryant/random',
|
| 277 |
+
"batch_size": 8,
|
| 278 |
+
"learning_rate": 2e-6,
|
| 279 |
+
"weight_decay": 0.007,
|
| 280 |
+
"num_epochs": 2,
|
| 281 |
+
"patience": 10, # for early stopping
|
| 282 |
+
"max_frames": 10,
|
| 283 |
+
"sigma": 0.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
"image_size": 224,
|
| 285 |
+
"flip_probability": 0.5,
|
| 286 |
+
"rotation_degrees": 15,
|
| 287 |
+
"brightness_jitter": 0.2,
|
| 288 |
+
"contrast_jitter": 0.2,
|
| 289 |
+
"saturation_jitter": 0.2,
|
| 290 |
+
"hue_jitter": 0.1,
|
| 291 |
+
"crop_scale_min": 0.8,
|
| 292 |
"crop_scale_max": 1.0,
|
| 293 |
+
"normalization_mean": [0.485, 0.456, 0.406],
|
| 294 |
+
"normalization_std": [0.229, 0.224, 0.225],
|
| 295 |
+
"unfreeze_layers": 3,
|
| 296 |
+
# "clip_model": "openai/clip-vit-large-patch14",
|
| 297 |
+
"clip_model": "openai/clip-vit-base-patch32",
|
| 298 |
+
"gradient_clip_max_norm": 1.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
"overfitting_threshold": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
"run_dir": run_dir,
|
| 301 |
}
|
| 302 |
train_and_evaluate(config)
|
script/visualization/visualize.py
CHANGED
|
@@ -204,9 +204,7 @@ def run_visualization(run_dir, data_path=None, test_csv=None):
|
|
| 204 |
|
| 205 |
if __name__ == "__main__":
|
| 206 |
# Find the most recent run directory
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
#
|
| 210 |
-
|
| 211 |
-
data_path = "/home/bawolf/workspace/break/finetune/blog/combined/all"
|
| 212 |
-
run_visualization(run_dir, data_path=data_path)
|
|
|
|
| 204 |
|
| 205 |
if __name__ == "__main__":
|
| 206 |
# Find the most recent run directory
|
| 207 |
+
run_dir = get_latest_run_dir()
|
| 208 |
+
|
| 209 |
+
# add a data_path argument to visualize a specific dataset
|
| 210 |
+
run_visualization(run_dir)
|
|
|
|
|
|
script/visualization/viz_cross_compare.py
CHANGED
|
@@ -5,10 +5,10 @@ from visualize import run_visualization
|
|
| 5 |
def get_opposite_dataset_path(run_folder):
|
| 6 |
# Map run folders to their corresponding opposite dataset training files
|
| 7 |
dataset_mapping = {
|
| 8 |
-
'search_bryant_adjusted': '
|
| 9 |
-
'search_bryant_random': '
|
| 10 |
-
'search_youtube_adjusted': '
|
| 11 |
-
'search_youtube_random': '
|
| 12 |
}
|
| 13 |
|
| 14 |
for folder_prefix, dataset_path in dataset_mapping.items():
|
|
|
|
| 5 |
def get_opposite_dataset_path(run_folder):
|
| 6 |
# Map run folders to their corresponding opposite dataset training files
|
| 7 |
dataset_mapping = {
|
| 8 |
+
'search_bryant_adjusted': './data/blog/datasets/youtube/adjusted',
|
| 9 |
+
'search_bryant_random': './data/blog/datasets/youtube/random',
|
| 10 |
+
'search_youtube_adjusted': './data/blog/datasets/bryant/adjusted',
|
| 11 |
+
'search_youtube_random': './data/blog/datasets/bryant/random'
|
| 12 |
}
|
| 13 |
|
| 14 |
for folder_prefix, dataset_path in dataset_mapping.items():
|