CosmoStat / BlendHunter

Deep learning tool for identifying blended galaxy images in survey images.
MIT License
4 stars 3 forks source link

blendhunter

PyPI pyversions

BlendHunter

Deep learning tool for identifying blended galaxy images in survey images.


Main contributor: Samuel Farrens
Email: samuel.farrens@cea.fr

BlendHunter implements the VGG16 CNN to identify blended galaxy images in postage stamps.

Dependencies

The following python packages should be installed with their specific dependencies:

Local installation

git clone https://github.com/CosmoStat/BlendHunter.git

Quick usage

Configuration setup:

from blendhunter.config import BHConfig

bhconfig = BHConfig(config_file='../data/bhconfig.yml').config
in_path = bhconfig['in_path']
out_path = bhconfig['out_path']
noise_sigma = bhconfig['noise_sigma']
n_noise_real = bhconfig['n_noise_real']
sample_range = slice(*bhconfig['sep_sample_range'])

Create 35 directories for padded parametric images and prepare data:

python create_directories.py
python prep_data.py

Run BlendHunter network and Source-Extractor as a bechmark:

python run_bh.py
python run_sep.py

Test on COSMOS images

python test_cosmos.py

Visualize results

Get simulations labels:

labels = np.load(os.path.join(out_path, 'labels.npy')).flatten()

Get accuracy on simulations:

from blendhunter.performance import get_acc

bh_mean, bh_std = get_acc('bh_pad_results', out_path, noise_sigma, n_noise_real, labels)
sep_mean, sep_std = get_acc('sep_pad_results', out_path, noise_sigma, n_noise_real, labels)

Plot results with error bars:

Accuracy plot

Get labels and accuracy on Cosmos images:

labels = np.load(os.path.join(out_path, 'cosmos_labels.npy')).flatten()
bh_mean, bh_std = get_acc('cosmos_results_pad', out_path, noise_sigma, n_noise_real, labels)

Plot results: