-
Notifications
You must be signed in to change notification settings - Fork 1
Release/rc0.1 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nikitashvarts
wants to merge
12
commits into
develop
Choose a base branch
from
release/rc0.1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Release/rc0.1 #15
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4b0d54d
Change repo structure, refactor CADA-VAE, add Trainer abstraction
3e561ca
Add evaluator base draft, add small comments
09516a7
Globally refactored project structure, removed unnecessary scripts, s…
e6ca4ef
WIP Project structure refactoring
f098bde
Merge remote-tracking branch 'origin/feature/#8-dataloader-refactorin…
80c329d
Additional merge remote-tracking branch 'origin/feature/#8-dataloader…
bbfe953
WIP Add script for MAT files (from edgarschnfld repo) parsing for CUB…
f4edd9f
Fix issue with clsattr_data generation in parse_cub_resnet101_mat.py
b70234a
WIP Refactoring of the entire project, changed ObjEmbDataset to ModEm…
3c1a980
Separate CADA-VAE inference, refactor CADA-VAE training
549b174
WIP Adapting classifier for new data loaders
c76bd1c
WIP Global refactoring of the project architecture
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,6 @@ | ||
| Using built-in datasets | ||
| ======================= | ||
|
|
||
| ZeroShotEval is provided with 2 build-in datasest: | ||
| - AWA2 | ||
| - CUB | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -12,4 +12,4 @@ CLS: | |
| AMSGRAD: True | ||
| DATA: | ||
| FEAT_EMB: | ||
| PATH: "data/CUB/resnet101/" | ||
| PATH: "datasets/CUB/resnet101/" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Все ещё сомневаюсь насчет этого переименования |
||
This file contains hidden or 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,20 @@ | ||
| """ | ||
| Script that extracts embeddings from raw data (images, texts) and saves it to | ||
| disk for further Zero-Shot experiments. Run this before | ||
| `run_zeroshot_experiment.py` to generate data for training. | ||
| """ | ||
|
|
||
| if __name__ == '__main__': | ||
| # STEP 0 - DATA PREPARATION | ||
| # (DO IT MANUALLY BEFORE RUNNING THIS SCRIPT) | ||
| # Prepare dataset CSV with file names to use for raw data loading. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| # STEP 1 - EMBEDDINGS EXTRACTION | ||
| # Extract embeddings from raw data with specified NN and save it to | ||
| # the disk. Note that embedding extractor can load data as a whole or | ||
| # using iterators (to fit into RAM). This step also creates a CSV with | ||
| # paths to all embedding files. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| pass |
This file contains hidden or 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,90 @@ | ||
| """Main script-launcher for training of ZSL models.""" | ||
|
|
||
| import os | ||
| from argparse import Namespace | ||
| from typing import Callable, Tuple | ||
|
|
||
| from fvcore.common.config import CfgNode | ||
| from torch.nn import Module | ||
|
|
||
| from zeroshoteval.evaluation.classification import classification_procedure | ||
| from zeroshoteval.utils.defaults import default_setup | ||
| from zeroshoteval.utils.parser import load_config, parse_args | ||
| from zeroshoteval.zeroshotnets.build import ( | ||
| build_zeroshot_train, | ||
| build_zeroshot_inference | ||
| ) | ||
| from zeroshoteval.zeroshotnets.cada_vae.cada_vae_inference import CADA_VAE_inference_procedure | ||
|
|
||
| # os.chdir("../") | ||
|
|
||
|
|
||
| def experiment(cfg: CfgNode) -> None: | ||
| """ | ||
| Start single experiment with the specified configs. Note that this procedure | ||
| requires data embeddings, extracted previously. If you don't have the | ||
| extracted embeddings, use the `run_embedding_extractor.py` script. | ||
|
|
||
| Args: | ||
| cfg(CfgNode): Configs. Details can be found in | ||
| zeroshoteval/config/defaults.py | ||
| """ | ||
|
|
||
| # MODEL TRAINING | ||
| # ============== | ||
| # Pass extracted embeddings to a zero-shot neural network to train it as an | ||
| # embedding extractor. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| # Embeddings loading from disk | ||
| # TODO: Replace ModalitiesEmbeddingDataset with loader from separate files | ||
|
|
||
| # Get training procedure function from registry | ||
| train_procedure: Callable[[CfgNode], Module] = build_zeroshot_train(cfg) | ||
|
|
||
| # Training | ||
| zsl_model: Module = train_procedure(cfg) | ||
|
|
||
| # MODEL INFERENCE | ||
| # =============== | ||
| # Apply trained model to test data and (similar to the prev step) extract | ||
| # zero-shot embeddings. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| # TODO: replace CADA-VAE with general model | ||
|
|
||
| # Get inference procedure function from registry | ||
| inference_procedure: Callable[[CfgNode, Module], Tuple[Tuple, Tuple]] = build_zeroshot_inference(cfg) | ||
|
|
||
| # Inference | ||
| train_data, test_data = inference_procedure(cfg, zsl_model) | ||
|
|
||
| # MODEL EVALUATION | ||
| # ================ | ||
| # Pass extracted zero-shot embeddings to one of evaluation tasks ( | ||
| # classification, clustering, verification, etc.) | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| # TODO: replace classification procedure with more general evaluation calling | ||
| classification_procedure(cfg, train_data, test_data) | ||
|
|
||
|
|
||
| def main() -> None: | ||
| # Parse arguments | ||
| experiment_options: Namespace = parse_args() | ||
|
|
||
| # Load default configuration and merge with specific configs from args | ||
| cfg: CfgNode = load_config(experiment_options) | ||
|
|
||
| # Freeze current config to avoid arbitrary changes | ||
| cfg.freeze() | ||
|
|
||
| # Perform some basic common setups at the beginning of a job | ||
| default_setup(cfg, experiment_options) | ||
|
|
||
| # Start the experiment | ||
| experiment(cfg) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что мешает использовать, например, SUN?