Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

A free and open source tool for star removal in astronomy images. A GAN model implemented in tensorflow and trained to remove stars from astronomical images

License

code2k13/starreduction

Repository files navigation

Star reduction in deep sky images

⚠️ This repository has been archived. Please checkout my new shiny tool (Starrem2k13) for star removal : https://code2k13.github.io/starrem2k13/

A GAN model trained to remove stars from astronomical images. Code was inspired from a sample at Tensorflow's website. The training data consists of only two images. One image of the Helix nebula and another is a starmap that was created from a star cluster image. Here is how the results look like:

images/example2.png

images/example.png

Running using Docker (Recommended)

docker run   -v $PWD:/usr/src/app/starreduction/data  \
-it code2k13/starreduction \
/bin/bash -c "./removestars.py ./data/example.jpg  ./data/example_starless.jpg"

Note that $PWD refers to your current working directory. In the above example it is assumed that the file example.jpg resides in your current working directory. This directory is mounted as a volume with the path /usr/src/app/starreduction/data inside the docker container. The output image example_starless.jpg will also be written to same directory.

Running without Docker

Clone the repository and navigate to the 'starreduction' folder. Install required packages :

pip install -r requirements.txt

Additionally you may also have to install lfs support for git

git clone https://github.com/code2k13/starreduction.git
cd starreduction
sudo apt-get install git-lfs
git lfs pull

Run inference on image.

python removestars.py image_with_stars.jpg  image_without_stars.jpg

Supprots greyscale and RGB images. Alpha channel (if any) in the source image is removed during processing. Gives issues on some types of TIFF files.

Trying out the model in a web browser

Here is link to a online demo of star reduction created using a trained model, TFJS and ReactJS. Please use a desktop browser to access the demo (for memory and performance reasons). The demo runs locally inside your browser, no data outside of your computer. Here is the link to the demo : https://ashishware.com/static/star_removal/index.html

Training model on your images

The notebook is available in the train folder.

You can also view/run it on Kaggle: https://www.kaggle.com/finalepoch/star-removal-from-astronomical-images-with-pix2pix

Attribution

The training images used in this code were sourced from Wikimedia Commons and processed using GIMP.

Antennae Galaxy Image

This image was downloaded from Wikimedia Commons and converted to grayscale using GIMP by me for purpose of training the model.

Link to processed image: training_data/Antennae_galaxies_xl.png

NASA, ESA, and the Hubble Heritage Team (STScI/AURA)-ESA/Hubble Collaboration, Public domain, via Wikimedia Commons

Url : https://commons.wikimedia.org/wiki/File:Antennae_galaxies_xl.jpg

Direct Link: https://upload.wikimedia.org/wikipedia/commons/f/f6/Antennae_galaxies_xl.jpg

Star cluster NGC 3572 and its surroundings

This image was downloaded from Wikimedia Commons and star mask was created by me using GIMP

Link to the processed image: training_data/star_map_base.png

ESO/G. Beccari, CC BY 4.0, via Wikimedia Commons

Url: https://commons.wikimedia.org/wiki/File:The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg

Direct Link: https://upload.wikimedia.org/wikipedia/commons/9/95/The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg