This is the PyTorch version repo for Precise Augmentation and Counting of Helicobacter Pylori in Histology Image in NeurIPS 2022 workshop, which study the precise counting of Helicobacter Pylori (HP).
HP counting corpus HPCDataset url: Google Drive
- Get into the Generative model directory.
cd DCGAN/
- Run DCGAN to generate single HP images.
python image_generation.py input.yaml
Parameters and input/output paths are passed through a .yaml file. An example of all flags is stated below:
arch: 'DCGAN'
path: '/path/to/images/'
out: '/path/to/output/images'
run: 'name'
seed: 95
n_gpu: 1
num_epochs: 200
learning_rate: 0.0001
beta_adam: 0.5
batch_size: 8
latent_vector: 64
image_size: 64
loader_workers: 2
number_channels: 3
gen_feature_maps: 64
dis_feature_maps: 64
- Get into the synthetic directory.
cd synthetic/
- Prepare the data
single/: single hp images generated by DCGAN.
single_clear/: single hp images with background noise removed
images/: real data.
- image blending
python place_random.py
- Ground Truth
Please follow the make_dataset.ipynb
to generate the ground truth. It shall take some time to generate the dynamic ground truth. Note you need to generate your own json file.
- Density Map
Generating the density map with a Gaussian kernel.
python gen_density.py
- Training
python train.py train.json test.json 0 0
- Testing
Follow the
val.ipynb
to try the validation. You can try to modify the notebook and see the output of each image.