Skip to content

Commit

Permalink
Navigate example config
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristina Ulicna committed Jul 11, 2023
1 parent 7869d7d commit cfb907f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions grace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ The `config_file` should be structured as follows:
"log_dir": "--same--as--above--",
# Feature extractor:
"extractor_fn": "/absolute/path/to/your/feature/extractor/resnet152.pt",
"feature_dim": "2048", -> if using ResNet 50 / 101 / 152, "512" if using ResNet 18 / 34; = input channels into the classifier
"extractor_fn": "/path/to/your/feature/extractor/resnet152.pt",
"feature_dim": "2048", -> if using ResNet 50 / 101 / 152,
"512" if using ResNet 18 / 34; = input channels into the classifier
# Patch data specs:
"patch_size": "(224, 224)", -> size of the patch to crop & feed to feature extractor
Expand All @@ -56,6 +57,19 @@ The `config_file` should be structured as follows:

_Note:_ Write the parameters into a single line, the file will be parsed accordingly.

Downloading the feature extractor:

In case you decide to use a pre-trained image classifier, such as resnet-152, you can use this snippet to import the model, load the default weights & download the model:

```sh
import torch
from grace.models.feature_extractor import resnet

resnet_model = resnet(resnet_type="resnet152")
extractor_fn = "/path/to/your/feature/extractor/resnet152.pt"
torch.save(resnet_model, extractor_fn)
```


## Full list of graph / patch augmentations:

Expand Down
2 changes: 1 addition & 1 deletion grace/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"image_dir": "/Users/kulicna/Desktop/classifier/data_fake/train/padded", "grace_dir": "/Users/kulicna/Desktop/classifier/data_fake/train/padded", "log_dir": "/Users/kulicna/Desktop/classifier/runs", "run_dir": "/Users/kulicna/Desktop/classifier/runs", "extractor_fn": "/Users/kulicna/Desktop/classifier/extractor/resnet152.pt", "feature_dim": "2048", "patch_size": "(112, 112)", "ignore_fraction": "1.0", "img_graph_augs": "[]", "img_graph_aug_params": "[]", "patch_augs": "[]", "patch_aug_params": "[]", "hidden_channels": "[512, 128, 32]", "num_node_classes": "2", "num_edge_classes": "2", "epochs": "200", "metrics": "['accuracy', 'confusion_matrix']"}
{"image_dir": "/path/to/your/images", "grace_dir": "/path/to/your/annotations", "log_dir": "/path/to/your/classifier/runs", "run_dir": "/path/to/your/classifier/runs", "extractor_fn": "/path/to/your/extractor/resnet152.pt", "feature_dim": "2048", "patch_size": "(224, 224)", "keep_patch_fraction": "1.0", "img_graph_augs": "[]", "img_graph_aug_params": "[]", "patch_augs": "[]", "patch_aug_params": "[]", "hidden_channels": "[512, 128, 32]", "num_node_classes": "2", "num_edge_classes": "2", "epochs": "10", "metrics": "['accuracy', 'confusion_matrix']"}

0 comments on commit cfb907f

Please sign in to comment.