The shocking image shows the baby in the middle of the tracks while a woman crouches in front of it to take a photo.
The photo was posted by The Bell Tower Times twitter account.
It is not known when the photo was taken but some people commenting on the post said Transperth trains did not use that particular section of the track.
The WA Public Transport Authority has been contacted for comment.
In 2017 PTA communications manager David Hynes warned that taking photos on the train tracks was “dangerous and illegal”.
““Being on the tracks or within the rail reserve, without a permit and other than for traversing a pedestrian crossing, is classified as trespassing.”
Some level crossings on Fremantle and Midland heritage lines are so popular with photographers that the PTA have installed signs discouraging the practice.
This article originally appeared on The West Australian.