|
| 1 | +# Star reduction in deep sky images |
| 2 | + |
| 3 | +Starrem2k13 is a simple and easy tool to remove stars from astronomical images. Starrem2k13 uses a GAN trained on augmented data. Code was inspired from a [sample at Tensorflow's website](https://www.tensorflow.org/tutorials/generative/pix2pix). 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: |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +# Installing |
| 11 | +Currently binaries for Windows, Linux and MacOS are available in the releases section. These were created using PyInstaller. Using pre-complied binaries is the recommended way of running Starrem2k13. Once you have downloaded and installed the program you can run it simply by typing the following in command prompt/terminal |
| 12 | + |
| 13 | +Run inference on image. |
| 14 | +```shell |
| 15 | +starrem2k13 image_with_stars.jpg image_without_stars.jpg |
| 16 | +``` |
| 17 | + |
| 18 | +## Running using Docker (Recommended) |
| 19 | + |
| 20 | +``` |
| 21 | +docker run -v $PWD:/usr/src/app/starrem2k13/data \ |
| 22 | +-it code2k13/starrem2k13 \ |
| 23 | +/bin/bash -c "./starrem2k13.py ./data/example.jpg ./data/example_starless.jpg" |
| 24 | +``` |
| 25 | +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/starrem2k13/data* inside the docker container. The output image *example_starless.jpg* will also be written to same directory. |
| 26 | + |
| 27 | + |
| 28 | +## Running with local python installation |
| 29 | +Clone the repository and navigate to the 'starrem2k13' folder. Install required packages : |
| 30 | + |
| 31 | +```shell |
| 32 | +pip install -r requirements.txt |
| 33 | +``` |
| 34 | + |
| 35 | +Additionally you may also have to install lfs support for git |
| 36 | +``` |
| 37 | +git clone https://github.com/code2k13/starrem2k13.git |
| 38 | +cd starrem2k13 |
| 39 | +sudo apt-get install git-lfs |
| 40 | +git lfs pull |
| 41 | +``` |
| 42 | + |
| 43 | +Run inference on image. |
| 44 | +```shell |
| 45 | +python starrem2k13.py image_with_stars.jpg image_without_stars.jpg |
| 46 | +``` |
| 47 | + |
| 48 | +> 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. |
| 49 | +
|
| 50 | + |
| 51 | +## Trying out the model in a web browser |
| 52 | +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 |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +## Training model on your images |
| 57 | + |
| 58 | +The [notebook](train/star-removal-from-astronomical-images-with-pix2pix.ipynb) is available in the train folder. |
| 59 | + |
| 60 | +You can also view/run it on Kaggle: |
| 61 | +[https://www.kaggle.com/finalepoch/star-removal-from-astronomical-images-with-pix2pix](https://www.kaggle.com/finalepoch/star-removal-from-astronomical-images-with-pix2pix) |
| 62 | + |
| 63 | + |
| 64 | +## Attribution |
| 65 | + |
| 66 | +The training images used in this code were sourced from Wikimedia Commons and processed using GIMP. |
| 67 | + |
| 68 | +### Antennae Galaxy Image |
| 69 | +This image was downloaded from Wikimedia Commons and converted to grayscale using GIMP by me for purpose of training the model. |
| 70 | + |
| 71 | +Link to processed image: [training_data/Antennae_galaxies_xl.png](training_data/Antennae_galaxies_xl.png) |
| 72 | + |
| 73 | +>[NASA, ESA, and the Hubble Heritage Team (STScI/AURA)-ESA/Hubble Collaboration](https://commons.wikimedia.org/wiki/File:Antennae_galaxies_xl.jpg), Public domain, via Wikimedia Commons |
| 74 | +
|
| 75 | +Url : [https://commons.wikimedia.org/wiki/File:Antennae_galaxies_xl.jpg](https://commons.wikimedia.org/wiki/File:Antennae_galaxies_xl.jpg) |
| 76 | + |
| 77 | +Direct Link: [https://upload.wikimedia.org/wikipedia/commons/f/f6/Antennae_galaxies_xl.jpg](https://upload.wikimedia.org/wikipedia/commons/f/f6/Antennae_galaxies_xl.jpg) |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +### Star cluster NGC 3572 and its surroundings |
| 82 | +This image was downloaded from Wikimedia Commons and star mask was created by me using GIMP |
| 83 | + |
| 84 | +Link to the processed image: [training_data/star_map_base.png](training_data/star_map_base.png) |
| 85 | + |
| 86 | +> [ESO/G. Beccari, CC BY 4.0](https://creativecommons.org/licenses/by/4.0), via Wikimedia Commons |
| 87 | +
|
| 88 | +Url: [https://commons.wikimedia.org/wiki/File:The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg](https://commons.wikimedia.org/wiki/File:The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg) |
| 89 | + |
| 90 | +Direct Link: [https://upload.wikimedia.org/wikipedia/commons/9/95/The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg](https://upload.wikimedia.org/wikipedia/commons/9/95/The_star_cluster_NGC_3572_and_its_dramatic_surroundings.jpg) |
| 91 | + |
| 92 | + |
| 93 | + |
0 commit comments