{"id":18305331,"url":"https://github.com/mrcfps/wesup","last_synced_at":"2025-04-05T16:32:35.261Z","repository":{"id":85482368,"uuid":"180370819","full_name":"mrcfps/WESUP","owner":"mrcfps","description":"Source code for *Weakly Supervised Histopathology Image Segmentation with Sparse Point Annotations*.","archived":false,"fork":false,"pushed_at":"2021-07-08T15:25:02.000Z","size":645,"stargazers_count":15,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T06:51:14.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/mrcfps.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,"publiccode":null,"codemeta":null}},"created_at":"2019-04-09T13:16:40.000Z","updated_at":"2024-10-02T15:06:15.000Z","dependencies_parsed_at":"2023-03-03T11:45:19.902Z","dependency_job_id":null,"html_url":"https://github.com/mrcfps/WESUP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcfps%2FWESUP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcfps%2FWESUP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcfps%2FWESUP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcfps%2FWESUP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcfps","download_url":"https://codeload.github.com/mrcfps/WESUP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366829,"owners_count":20927596,"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","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":"2024-11-05T15:33:57.109Z","updated_at":"2025-04-05T16:32:35.255Z","avatar_url":"https://github.com/mrcfps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WESUP\n\nSource code for our paper *Weakly Supervised Histopathology Image Segmentation with Sparse Point Annotations*.\n\n## Data Preparation\n\n### MICCAI 2015 Gland Segmentation (GlaS)\n\n[GlaS challenge](https://warwick.ac.uk/fac/sci/dcs/research/tia/glascontest/) is a well-known H\u0026E stained digital pathology dataset for medical image segmentation. Download the dataset from [here](https://warwick.ac.uk/fac/sci/dcs/research/tia/glascontest/download/warwick_qu_dataset_released_2016_07_08.zip). Then run the following convenience script to organize the dataset:\n\n```bash\n$ python prepare_glas.py /path/to/downloaded/dataset -o data_glas\n```\n\nThe mask-level fully-annotated dataset `data_glas` looks like this:\n\n```\ndata_glas\n├── train\n│   ├── images\n│   │   ├── train-1.png\n│   │   └── train-2.png\n│   └── masks\n│       ├── train-1.png\n│       └── train-2.png\n└── val\n    ├── images\n    │   ├── val-1.png\n    │   └── val-2.png\n    └── masks\n        ├── val-1.png\n        └── val-2.png\n```\n\n### Colorectal Adenocarcinoma Gland (CRAG) dataset\n\nDownload the dataset from this [link](https://warwick.ac.uk/fac/sci/dcs/research/tia/data/mildnet/). Then organize this dataset like GlaS mentioned above.\n\n### Generating point labels\n\n```bash\n$ python scripts/generate_points.py /path/to/dataset -p 1e-4\n```\n\n\u003e The `-p` or `--label-percent` argument is for controlling the percentage of labeled pixels. Larger value means stronger supervision.\n\nThen `labels` directory storing point labels will be generated alongside `images` and `masks`. Each csv file within `labels` directory correspond to a training image, with each row (a triple) representing a point:\n\n```csv\np1_top,p1_left,p1_class\np2_top,p2_left,p2_class\n```\n\n### Visualizing point labels\n\n```bash\n$ python scripts/visualize_points.py data_glas/train\n```\n\nYou will see visualization outputs in `data_glas/train/viz`.\n\n## Training\n\n### Training from scratch\n\n```bash\n$ python train.py /path/to/dataset --epochs 100\n```\n\n### Resume training from a checkpoint\n\n```bash\n$ python train.py /path/to/dataset --epochs 100 --checkpoint /path/to/checkpoint\n```\n\n### Recording multple runs\n\nBy default, each run will be stored within a timestamped directory within `records`. The structure of a record directory is as follows:\n\n```\nrecords/20190423-1122-AM\n├── checkpoints\n│   ├── ckpt.0001.pth\n│   ├── ckpt.0002.pth\n│   └── ckpt.0003.pth\n├── curves\n│   ├── loss.png\n│   ├── pixel_acc.png\n│   └── sp_acc.png\n├── history.csv\n├── params\n│   ├── 0.json\n│   └── 1.json\n└── source\n```\n\n- `checkpoints` directory stores all training checkpoints\n- `curves` stores learning curves for loss and all metrics\n- `params` stores CLI and configuration parameters\n- `source` stores a snapshot of all source code file\n- `history.csv` records the training history\n\n## Inference\n\nWe offer four types of inference utilities:\n\n- Superpixel-wise inference (the `infer.py` script)\n- Superpixel-wise inference with tiling strategy (the `infer_tile.py` script)\n- Pixel-wise inference (the `pixel_infer.py` script)\n- Pixel-wise inference with tiling strategy (the `pixel_infer_tile.py` script)\n\nExample:\n\n```bash\n$ python infer.py /path/to/test/data --checkpoint /path/to/checkpoint\n$ python pixel_infer_tile.py /path/to/test/data --checkpoint /path/to/checkpoint --patch-size 400\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcfps%2Fwesup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcfps%2Fwesup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcfps%2Fwesup/lists"}