-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move checkpoint type computation to utils * Refactor checkpointing in training script * Get ckpt type if ckpt is passed * optionally apply a data augmentation method (WIP) * fix config syntax in code * add data augmentation notebook * notebook to explore params of individual transformations * add transforms from config * Add keywords to datamodule params * Optionally skip data augmentation * If data augmentation key in config, apply * Update tests * Change tests to read default config * Refactor transform functions and clean up * update notebook * Fix data augmentation default config * Optionally log data augmentation transforms as artifacts * Rename skip to 'no_data_augmentation'
- Loading branch information
Showing
7 changed files
with
354 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# %% | ||
import yaml # type: ignore | ||
|
||
from crabs.detection_tracking.datamodules import CrabsDataModule | ||
from crabs.detection_tracking.visualization import plot_sample | ||
|
||
# %%%%%%%%%%%%%%%%%%% | ||
# Input data | ||
IMG_DIR = "/home/sminano/swc/project_crabs/data/sep2023-full/frames" | ||
ANNOT_FILE = "/home/sminano/swc/project_crabs/data/sep2023-full/annotations/VIA_JSON_combined_coco_gen.json" | ||
CONFIG = "/home/sminano/swc/project_crabs/crabs-exploration/crabs/detection_tracking/config/faster_rcnn.yaml" | ||
SPLIT_SEED = 42 | ||
|
||
# %%%%%%%%%%%%%%%%%%%% | ||
# Read config as dict | ||
with open(CONFIG, "r") as f: | ||
config_dict = yaml.safe_load(f) | ||
|
||
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
# Create datamodule for the input data | ||
dm = CrabsDataModule( | ||
list_img_dirs=[IMG_DIR], | ||
list_annotation_files=[ANNOT_FILE], | ||
config=config_dict, | ||
split_seed=SPLIT_SEED, | ||
) | ||
# %%%%%%%%%%%%%%%%%%%%%%%% | ||
# Setup for train / test | ||
dm.prepare_data() | ||
dm.setup("fit") | ||
|
||
|
||
# %%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
# after this: dm.train_dataset should have transforms, (but not dm.test_dataset) | ||
print(dm.train_transform) | ||
print(dm.val_transform) | ||
print(dm.test_transform) | ||
|
||
# %%%%%%%%%%%%%%%%%%%%%%%%% | ||
# visualize | ||
train_dataset = dm.train_dataset | ||
train_sample = train_dataset[0] | ||
plot_sample([train_sample]) | ||
|
||
# %% |
Oops, something went wrong.