March 5, 2018, by Dr. Meghan Gray

Student research: Teaching neural networks to identify gravitational lenses

The major research project in the fourth year of our MSci degree is a chance for students to get hands-on experience in the frontline physics research our academic staff are working on, i.e. where we don’t know what the answer is going to be when we start! Some projects lead to valuable advances in the field, and supervisors are always keen to help turn these into published papers where possible. In this guest post, James Pearson (MSci Physics with Astronomy 2017, now a first-year PhD student in the astronomy group) describes the work he did for his MSci project that was recently published in the peer-reviewed journal Emergent Scientist.


At Nottingham University, the final year of an MSci Physics degree involves working on a year-long research project. Supervised by Simon Dye, I worked with two other fourth-year students, Tom Robinson and Clara Pennock, to develop a simple yet effective automated method of detecting gravitational lenses from astronomical images, using a type of machine learning called convolutional neural networks (CNNs).

Gravitational lensing is the distortion of the paths of light rays due to a massive body, with such a body acting as a ‘lens’ for the light rays. If a light source is directly behind the lens we see arcs and rings of light around the lens known as Einstein rings or crosses, and it is these phenomena that the network tries to detect. We focussed on strong galaxy-galaxy lenses, in which the light source and the lens are both single galaxies. Such lenses can be of use in galaxy evolution models and dark matter simulations, and allow us to identify very distant galaxies. Upcoming telescopic surveys will produce billions of images, so we need an automated way of sifting through them to spot such lenses.

Our method used CNNs, but what are they? Just as the brain is made up of interconnected neurons, a neural network consists of layers of nodes, with nodes connected between layers and the strengths of these connections given by a ‘weight’ value. CNNs are a subset of neural networks that have grid-like layers mainly for analysing images, and apply convolutional filters (kernels) in order to extract information. Such filters are often used in image processing, for use in sharpening or blurring a picture, as well as for edge detection. The weights mentioned earlier can be modified through training the network, which help it to become much more accurate. However, CNNs typically require a minimum of tens of thousands of images for training; as not enough real images exist of lenses, the project also involved simulating our own.

One of the figures from James’ paper: simulated strongly lensed galaxies used to test the detection methods, with four real systems on the right for comparison.

Training on such large image catalogues was very time-consuming, sometimes taking hours to do, and finding the optimal design of the CNN was also difficult as it is highly dependent on the images used. Despite these setbacks, we succeeded in using a simple network to detect lenses with high accuracy, even going on to use a variant of a CNN to highlight where in the image such lenses resided.

There was a lot of research to be done for the project as most of this was new to all three of us, especially the machine learning! While there’s a lot of work involved, a large chunk of the year is dedicated to the project, which itself is good preparation for those wishing to pursue a career in research. I thoroughly enjoyed it, and submitting a report at the end of the year was a welcome change from exams!

During the year, I was fairly sure that I wanted to do an astronomy PhD. Consulting the list of projects proposed here at Nottingham, there were several I was interested in, but one caught my eye – Simon had put forward a continuation of the same project, which would build on top of the work we had started. With the knowledge I had accumulated, it felt like a natural step for me to take. Hence I’m now working towards not just detecting lensing galaxies, but to also estimate their parameters, still just using CNNs and images!

Once we had finished our research project report, Simon offered us the chance to publish our work in Emergent Scientist, a new open access scientific journal aimed mainly at students. We of course jumped at the chance, and began condensing our report. Writing the paper for submission was quite hard work as we needed to really cut down the report, ultimately from around thirty pages to ten. This did however help us identify the really key details, figures and results that would be most useful in a published paper.

We submitted our first draft near the end of July, and had some feedback from referees with proposed changes. The paper was updated and resubmitted, and this process continued until finally the paper was accepted four months later, partly because we had each moved on to further work.

After that, we were sent the final proofs to check through, and the paper was published online, three months after it was accepted. Despite the lengthy process, it was well worth doing, as not only was it our first publication, it also helped prepare us for our future careers.

Posted in NewsResearchScientific writingStudent ResearchUndergraduates