diff --git a/hydra_flash/conf/config1.yaml b/hydra_flash/conf/config1.yaml index 89f78e57fc048b234e02e4575f09426bd20b027e..c83aafc41051b28ab978fd5fd603a1583584a90c 100644 --- a/hydra_flash/conf/config1.yaml +++ b/hydra_flash/conf/config1.yaml @@ -1,7 +1,7 @@ preprocess: _target_: flash.core.data.utils.download_data url: "https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip" - path: "./data" + path: "/tmp" datamodule: _target_: flash.image.ImageClassificationData.from_folders @@ -26,7 +26,10 @@ trainer: predict_datamodule: _target_: flash.image.ImageClassificationData.from_files predict_files: - - "data/hymenoptera_data/val/bees/65038344_52a45d090d.jpg" - - "data/hymenoptera_data/val/bees/590318879_68cf112861.jpg" - - "data/hymenoptera_data/val/ants/540543309_ddbb193ee5.jpg" + - "${preprocess.path}/hymenoptera_data/val/bees/65038344_52a45d090d.jpg" + - "${preprocess.path}/hymenoptera_data/val/bees/590318879_68cf112861.jpg" + - "${preprocess.path}/hymenoptera_data/val/ants/540543309_ddbb193ee5.jpg" batch_size: 3 + +show: true +save: false diff --git a/hydra_flash/conf/datamodule/lyft.yaml b/hydra_flash/conf/datamodule/lyft.yaml deleted file mode 100644 index 26e2b3b6b8cf213fec364de9bea3df494986aa1c..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/datamodule/lyft.yaml +++ /dev/null @@ -1,8 +0,0 @@ -_target_: flash.image.SemanticSegmentationData.from_folders -train_folder: "${preprocess.path}/CameraRGB" -train_target_folder: "${preprocess.path}/CameraSeg" -val_split: 0.1 -transform_kwargs: - image_size: [256, 256] -num_classes: 21 -batch_size: 4 diff --git a/hydra_flash/conf/datamodule/lyft_test.yaml b/hydra_flash/conf/datamodule/lyft_test.yaml deleted file mode 100644 index ea649de6124940128d144003239e2f6ec4503f1d..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/datamodule/lyft_test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -_target_: flash.image.SemanticSegmentationData.from_files -predict_files: - - "${preprocess.path}/CameraRGB/F61-1.png" - - "${preprocess.path}/CameraRGB/F62-1.png" - - "${preprocess.path}/CameraRGB/F63-1.png" -batch_size: 3 diff --git a/hydra_flash/conf/datamodule/movie_posters.yaml b/hydra_flash/conf/datamodule/movie_posters.yaml deleted file mode 100644 index a2cfa322dc7c6fc56ec1cf4103cc874d28c3ae5f..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/datamodule/movie_posters.yaml +++ /dev/null @@ -1,14 +0,0 @@ -_target_: flash.image.ImageClassificationData.from_csv -input_field: "Id" -target_fields: ["Action", "Romance", "Crime", "Thriller", "Adventure"] -train_file: ${preprocess.path}/movie_posters/train/metadata.csv -train_resolver: - _target_: hydra_flash.utils.resolver - _partial_: true -val_file: ${preprocess.path}/movie_posters/val/metadata.csv -val_resolver: - _target_: hydra_flash.utils.resolver - _partial_: true -transform_kwargs: - image_size: [128, 128] -batch_size: 1 diff --git a/hydra_flash/conf/datamodule/movie_posters_test.yaml b/hydra_flash/conf/datamodule/movie_posters_test.yaml deleted file mode 100644 index 9ad4083e560898b7224d1bd742fe500a4fc7c531..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/datamodule/movie_posters_test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -_target_: flash.image.ImageClassificationData.from_files -predict_files: - - "${preprocess.path}/movie_posters/predict/tt0085318.jpg" - - "${preprocess.path}/movie_posters/predict/tt0089461.jpg" - - "${preprocess.path}/movie_posters/predict/tt0097179.jpg" -batch_size: 3 diff --git a/hydra_flash/conf/experiment/__init__.py b/hydra_flash/conf/experiment/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/hydra_flash/conf/experiment/hymenoptera.yaml b/hydra_flash/conf/experiment/hymenoptera.yaml deleted file mode 100644 index 730f180b09377ddda343152c609bdc9376596659..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/experiment/hymenoptera.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# @package _global_ -defaults: - - _self_ - - /preprocess: hymenoptera - - /datamodule: hymenoptera - - /model: resnet18 - - /datamodule@predict_datamodule: hymenoptera_test - - /server: local - -trainer: - _target_: flash.Trainer - max_epochs: 3 - gpus: 1 diff --git a/hydra_flash/conf/experiment/lyft.yaml b/hydra_flash/conf/experiment/lyft.yaml deleted file mode 100644 index 54a551426daa4ee829bc7da7467ce9ef4cc710e6..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/experiment/lyft.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# @package _global_ -defaults: - - _self_ - - /preprocess: lyft - - /datamodule: lyft - - /model: seg_mobilenet - - /datamodule@predict_datamodule: lyft_test - - /server: local - -trainer: - _target_: flash.Trainer - max_epochs: 3 - gpus: 1 diff --git a/hydra_flash/conf/experiment/movie_poster.yaml b/hydra_flash/conf/experiment/movie_poster.yaml deleted file mode 100644 index 4172b87bd94afe2f20bb991ec81d7c3bad01599c..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/experiment/movie_poster.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# @package _global_ -defaults: - - _self_ - - /preprocess: movie_poster - - /datamodule: movie_posters - - /model: resnet18 - - /datamodule@predict_datamodule: movie_posters_test - - /server: local - -trainer: - _target_: flash.Trainer - max_epochs: 3 - gpus: 1 diff --git a/hydra_flash/conf/model/resnet18.yaml b/hydra_flash/conf/model/resnet18.yaml index 7c0f8576c8f1545946dd9d58b423254645692a36..14f88f4f1d6d19dfd50ee06d22c4e64bfa1113c1 100644 --- a/hydra_flash/conf/model/resnet18.yaml +++ b/hydra_flash/conf/model/resnet18.yaml @@ -1,6 +1,3 @@ _target_: flash.image.ImageClassifier backbone: resnet18 learning_rate: 1.e-3 -complete: - - labels - - multi_label diff --git a/hydra_flash/conf/model/seg_mobilenet.yaml b/hydra_flash/conf/model/seg_mobilenet.yaml deleted file mode 100644 index bc512ff512ae3534cd35ba99290663b7822615c9..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/model/seg_mobilenet.yaml +++ /dev/null @@ -1,5 +0,0 @@ -_target_: flash.image.SemanticSegmentation -backbone: "mobilenetv3_large_100" -head: fpn -num_classes: ${datamodule.num_classes} -complete: [] diff --git a/hydra_flash/conf/preprocess/lyft.yaml b/hydra_flash/conf/preprocess/lyft.yaml deleted file mode 100644 index 63a8fe6a4bdf656fda3c5854bf2a2fa651b30358..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/preprocess/lyft.yaml +++ /dev/null @@ -1,4 +0,0 @@ -defaults: - - download - -url: "https://github.com/ongchinkiat/LyftPerceptionChallenge/releases/download/v0.1/carla-capture-20180513A.zip" diff --git a/hydra_flash/conf/preprocess/movie_poster.yaml b/hydra_flash/conf/preprocess/movie_poster.yaml deleted file mode 100644 index 492810af10f7a622af9bee7599073a17be8e184b..0000000000000000000000000000000000000000 --- a/hydra_flash/conf/preprocess/movie_poster.yaml +++ /dev/null @@ -1,4 +0,0 @@ -defaults: - - download - -url: "https://pl-flash-data.s3.amazonaws.com/movie_posters.zip" diff --git a/hydra_flash/train.py b/hydra_flash/train.py index 7fe5e085950e98b7491fb777226b8488bc64dac1..5770a5fe37c3029e5294a6bce282fb1b1c642ff0 100644 --- a/hydra_flash/train.py +++ b/hydra_flash/train.py @@ -11,7 +11,7 @@ log = logging.getLogger(__name__) instantiate = partial(hydra_instantiate, _convert_="all") -@hydra.main(version_base="1.1", config_path="conf", config_name="config") +@hydra.main(version_base="1.1", config_path="conf", config_name="config2") def main(cfg): # Preprocess : download and/or unzip data call(cfg.preprocess) @@ -20,11 +20,9 @@ def main(cfg): datamodule = instantiate(cfg.datamodule) # Create model - model_kwargs = {} - for kw in cfg.model.complete: - model_kwargs[kw] = getattr(datamodule, kw) - del cfg.model.complete - model = instantiate(cfg.model, **model_kwargs) + model = instantiate( + cfg.model, labels=datamodule.labels, multi_label=datamodule.multi_label + ) # Finetune model trainer = instantiate(cfg.trainer)