Starnet++ software, a program for the removal of stars from an image.
The Starnet++ program is written by Nikita Misiura, an astrophotographer who has placed the software on SourceForge where it is available free of charge.
There are various ways to remove stars from an image, but many of them involve a complex workflow and expensive software. Starnet++ is a solution that involves virtually no workflow and will remove stars in what appears to be a single step. This article is intended to provide a semi qualitative appreciation of what is involved with software of this kind.
Starnet++ is a neural network, or to be more precise, an Artificial Neural Net, ANN program. It is a convolutional neural network with encoder-decoder architecture, a type that is often used for image recognition and classification. The encoder is a convolution that acts as a feature extractor and the decoder is a deconvolution that recovers image details.
An ANN is a simulation in algorithms of the way that a brain is constructed from neurons. In fact, only between 10% to 50% of a brain is made of neurons. The rest is made from a variety of glial cells, which do not produce electrical impulses, but service and protect the neurons, providing support and services such as providing the neurons with oxygen and nutrients, and destroying pathogens.
The Neurons themselves, viewed simply, comprise; the main body of the cell, the soma, with extensions or dendrites that are the data input part of the neuron, and an axon, pipe-like structure that carries the output signal away from the main cell towards the branched axon terminals. The dendrites of one neuron receive signals from the axon terminals of another neuron via a junction called a synapse. The majority of signal propagation from neuron to neuron takes place via a chemical synapse or an electrical synapse. The electrical synapse uses ion channels, that allow an electrical current to flow between neurons. The electrical synapse is fast but does not carry the variety of signal that the slower, chemical synapses carry via their large variety of neurotransmitter biochemicals. In a real neural network, every neuron in the vicinity is connected to every other neuron. The majority of synapses in a mammal are chemical synapses.
The idea of an ANN was developed in 1943, when Warren McCulloch and Walter Pitts made a computational model for neural networks using algorithms. The model was called the 'McCulloch-Pitts neurons.' Of course, they were way ahead of their time in that the computational resources required did not exist at the time. However, computers and computer languages have since developed, so that artificial neural networks can be put to work on modern consumer computational devices.
How does an ANN work?
Remember that the artificial neural network is attempting to simulate how a real neural network works. Real neural networks learn by receiving lots of input data and processing them to produce an output. The output then feeds back into the network where it is compared with the goals of the operation. If the goals are partially achieved, (say the fairly reliable recognition of a particular type of animal) then the positive feedback reinforces the ongoing learning process. If you are shown lots of examples of dangerous insects then you will learn to recognise this sort of dangerous insect, as well as those that go along for the ride as evolutionary mimics. This sort of learning can take place in the classroom, but also in the experiences of everyday life.
An ANN works in an analogous way. However, there are no physical neurons as there are in a biological brain, Instead, there are software nodes. The nodes are connected (i.e. can affect each other) by software and each node contains two functions: a linear function and an activation function. The linear function does a specific calculation and the activation function, depending on the value computed by the linear function, ‘decides’ whether to ‘fire’ (i.e whether to send a signal to a connected node or not). The connection between two nodes has a value called a weight. Its magnitude determines the size of the effect of one node on another and the sign of the weight determines whether the effect is to reinforce or suppress the connected node. As the signal propagates through the network, it moves through sections whose calculations look at small groups of pixels 'looking' for small details and on to regions of the network that find larger features in the pixels. The system is learning to recognise stars, and then, to remove them. The neural network is based on linear algebra and GPUs are optimised for working with matrices, so powerful GPUs can facilitate the functioning of a neural network.
A typical artificial neural network has three groups of interconnected nodes. First is a ‘layer’ of input nodes that receive the input data. Second is a layer, or several layers of so-called hidden nodes. The hidden nodes receive data from the input nodes and the signal propagates according to the weights and the results of the calculations in the linear function, and the activation function, across the layers of hidden nodes. Finally, the signals that have got through to the output nodes, produce the output signal. What we want to give to the ANN is an image with stars and nebulosity, and to get out of it, an image with just the nebulosity and the stars removed.
The ANN will ‘learn’ by feedback, or backpropagation. This involves comparing the actual output with the intended output, in other words, to look for the differences between the output and the intended output. The difference is used to modify the weights of the connections between nodes in the network, going backwards from the output nodes, through the hidden nodes to the input nodes. This is what causes the network to learn and reduce the differences between the output and the intended output. Eventually, the process reduces the differences between the output and the intended output, until they are one and the same. In the case of our astronomical application, the input is an image with stars and nebulosity and the intended output is an image with the stars removed.
The teaching process involves training the network with many images from a particular type of system so that it can cumulatively learn from all of them. In the case of Starnet++ the ANN was taught with many images from a refractor system. The author of the program says that as a result of this, the software will not deal well with images from Newtonian telescopes which have diffraction spikes. It follows however, that if the software was to be trained with Newtonian images, it should be able to deal with the diffraction spikes and all.
Starnet++ doesn’t work on the whole image at once. The image is divided into square tiles, the size of which is controllable by the user via a variable called 'stride'. Stride defaults to 64 x 64 pixels. If the tiles are smaller, then the program runs slower, but produces an overall smoother result, and vice versa.
We present here two examples of the use of Starnet++. The first is the Orion nebula with the stars in place alternating in an animation with the nebula with the stars removed. This type of procedure enables the astronomer to study and appreciate the structure of the nebulosity without the distraction of the stars.
The Orion Nebula
The second example is Comet C/2020 F3 (NEOWISE). In this case, the star removal enables the structure of the comet to be studied without interference from the rich field of Background stars.
Comet C/2020 F3 (NEOWISE)
There are other reasons for removing stars from images, but those reasons will not be discussed here.
It is interesting that an aspect of AI can be used to perform an operation like star removal from astronomical images.