Problem in DL text-non text classification contest level 1 sample solution

I am able to understand the sigmoid class and other few fundamentals part of code. But I not really get the code
given in the code present in image below. Please, tell me what is exactly done in this code.


This is just some preprocessing being done. Can you please share which line are you facing doubt in?

In the below image I am not understanding what the ā€œLā€ is doing to our image


I mean what exactly is it converting

convert() is a PIL Library function, here the argument "L" is used to convert the image to grayscale, as it has only 1 channel.