{"id":26786788,"url":"https://github.com/marrlab/initial-data-point-selection","last_synced_at":"2025-09-16T15:59:33.473Z","repository":{"id":209059644,"uuid":"569302825","full_name":"marrlab/initial-data-point-selection","owner":"marrlab","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-20T10:54:45.000Z","size":1423,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T12:16:52.779Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marrlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-11-22T14:23:11.000Z","updated_at":"2023-11-24T19:04:20.000Z","dependencies_parsed_at":"2023-11-24T20:22:14.673Z","dependency_job_id":"a9e7da9d-9957-41e5-96a0-f3dab738cda3","html_url":"https://github.com/marrlab/initial-data-point-selection","commit_stats":null,"previous_names":["marrlab/inital-data-point-selection"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marrlab/initial-data-point-selection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2Finitial-data-point-selection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2Finitial-data-point-selection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2Finitial-data-point-selection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2Finitial-data-point-selection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marrlab","download_url":"https://codeload.github.com/marrlab/initial-data-point-selection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marrlab%2Finitial-data-point-selection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275446677,"owners_count":25466562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T12:16:55.133Z","updated_at":"2025-09-16T15:59:33.448Z","avatar_url":"https://github.com/marrlab.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inital-data-point-selection\n\nCodebase for the *A Data-Driven Solution for the Cold Start Problem in Biomedical Image Classification* paper submitted to ISBI 2024.\n\n![pipeline](assets/images/pipeline.png)\n\n## Structure\n\n- ```src/``` contains all the reusable source code.\n    - ```src/datasets/data/``` contains all the image datasets with a ```train/```, ```val/```, and ```test/``` subfolders.\n    - ```src/models/data/``` contains all the registered models, precomputed features, and metadata.\n- ```tasks/``` are all the scripts that use the source code to generate results saved in ```outputs/```.\n- [Hydra](https://hydra.cc/) is used for configurations, which are saved in ```conf/```.\n- [Weights \u0026 Biases](https://wandb.ai/site) is used for tracking runs and as a storage of results.\n\n## Set-up\n\nThe code has been tested to work well with Python 3.10.12.\n\n1. ```pip install -r requirements.txt```\n2. Put your Weights \u0026 Biases [API key](https://wandb.ai/authorize) in ```config.ini```.\n3. Run ```python -m tasks.datasets.download -d matek -d isic -d retinopathy -d jurkat``` to download all the used datasets.\n\n## Encoder Pretraining\n\nTo train [SimCLR](https://arxiv.org/abs/2002.05709) for the ```matek``` dataset run:\n```\npython -m tasks.training.train_simclr dataset=matek\n```\n\\\nTo train [SwAV](https://arxiv.org/pdf/2006.09882.pdf) for the ```matek``` dataset run:\n```\npython -m tasks.training.train_swav dataset=matek\n```\n\\\nTo train [DINO](https://arxiv.org/pdf/2104.14294.pdf) for the ```matek``` dataset run:\n```\npython -m tasks.training.train_dino dataset=matek\n```\n\\\nTo register model's weights after training run the following:\n```\npython -m tasks.backups.add_new_model \\\n    --path=[path to model weights in lightning_logs/] \\\n    --type=[simclr/swav/dino] \\\n    --version=[v1/v2/...] \\\n    --dataset=[dataset name]\n```\n\n## Feature Extraction \u0026 Precomputation\n\nTo extract features from a self-supervised model run the following:\n```\npython -m tasks.inference.extract_features \\\n    dataset=[dataset name] \\\n    training.weights.type=[simclr/swav/dino] \\\n    training.weights.version=[v1/v2/...]\n```\n\\\nTo precompute features from a self-supervised model with a number of random augmentations for each image run the following:\n```\npython -m tasks.inference.precompute_features \\\n    dataset=[dataset name] \\\n    training.weights.type=[simclr/swav/dino] \\\n    training.weights.version=[v1/v2/...] \\\n    num_augmentations=[number of random augmentations for each image]\n```\nThis allows us to save a lot of computation time in the Classifier Training step, since we freeze the weights of the encoder and train only the classifier head.\n\n\n## Classifier Training\nTo train the classifier head(s) and aggregate them into a final model using [Model Soups](https://arxiv.org/pdf/2203.05482.pdf) run the following:\n```\npython -m tasks.training.linear_classifier \\\n    dataset=[dataset name] \\\n    training.weights.type=[simclr/swav/dino] \\\n    training.weights.version=[v1/v2/...] \\\n    training.learning_rate=null\n```\nFeel free to tinker with the ```features```, ```kmeans```, and ```soup``` configurations.\n\nTo train the classifier head using all of the annotated data with proper hyperparameter selection using validation set run the following:\n```\npython -m tasks.training.linear_classifier_ceiling \\\n    dataset=[dataset name] \\\n    training.weights.type=[simclr/swav/dino] \\\n    training.weights.version=[v1/v2/...] \\\n    training.learning_rate=null \\\n    training.train_samples=null\n```\n\n\n## Visualisations\nCheck the ```tasks/vis/``` for all the scripts to visualise the results.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarrlab%2Finitial-data-point-selection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarrlab%2Finitial-data-point-selection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarrlab%2Finitial-data-point-selection/lists"}