Image copyright Getty Images

Some 20 years ago, four million people across the UK worked in manufacturing, but according to the Office for National Statistics that figure has dropped by 30% as new technology replaces jobs.

Former coal mining communities, already struggling with high levels of unemployment, have been hardest hit.

So much so, that in 2018 think tank the Centre for Social Justice (CSJ) identified 10 former manufacturing towns where social deprivation is already high, and jobs are at risk from automation.

The 10 post-industrial towns are Doncaster, Wigan, Blackpool, Mansfield, Barnsley, Bradford, Plymouth, Stoke-on-Trent, Wakefield and Dudley.

Patrick Spencer from the CSJ says they need to "cultivate a business community that's going to create jobs locally" in order to survive.

BBC Radio 4's You and Yours programme reports from two of those towns, Doncaster and Wigan, to find out what they're doing to turn things around.

Wigan: The home of Heinz

Wigan is a former mining town in Greater Manchester with a borough-wide population of more than 300,000.

Image copyright Getty Images/Topical Press Agency Image caption Coal production in the Wigan area was at its peak in the late Victorian era

It has a higher-than-average number of people working in factories, is above average for workless households, and lower than average for weekly wages.

One of its biggest employers, Heinz, opened its factory in Kitt Green in 1959.

Since then the speed with which they can make cans has dramatically increased. New can-filling technology means they can produce around one billion cans every year.

John Brockley works in the operations team at the factory. He's been with the company for 36 years, after starting as an apprentice when he was 16. Over that time he says that because of new technology, staff numbers have fallen from 3,000 down to around 800 on site.

Heinz dealt with the reduction in its workforce by offering good redundancy packages and reinvesting in the site.

Mr Brockley accepts there might come a time when his job is no longer needed.

Image copyright Heinz Image caption John Brockley has worked for Heinz his whole adult life

Offering good redundancy packages is one way of managing change. Another is to try to attract new businesses into these towns.

Wigan's Labour-led council has a policy of supporting new business by making sites available for development.

Council leader David Molyneux says it is part of a wider plan that includes attracting younger people to the town.

"We've got to turn out young people who've got the skills to grasp what the 21st Century has to offer," he says.

"A lot of people go off to university, but I want to make sure that they come back once they've got the skills we need to see Wigan grow."

There are some businesses in Wigan that are looking closely at what opportunities new technology can provide.

Keytech, a small IT business, is investing in virtual reality as a training tool. The idea is that they'll manage a system where trainees wear a virtual reality headset to learn how to do a job.

David Craig from the company says: "That will service many industries from medical, to logistics to field engineers. There will be investment for engineers to manage the virtual reality technology."

Listen to the You and Yours Wigan programme.

Doncaster and Amazon

Doncaster is a former mining town in South Yorkshire with a population of more than 300,000.

Image copyright Getty Images/Bert Hardy Image caption Mining in Doncaster has been replaced by a variety of companies in the services sector and light manufacturing

It has three Amazon fulfilment centres employing 1,000 staff, one of which is the size of 15 football pitches.

There is also an Amazon Pantry warehouse, one of just a few in the UK that uses robots.

Wages start at £9.50 per hour.

The robots bring pallets to the staff who pick and pack the items. The robots in Amazon warehouses in a number of locations including Doncaster and Dunstable, are controlled by a computer system, and only specially trained staff are allowed inside the floor where the robots are operating.

Jane Colquhoun started as a temporary worker after giving up her job as a cleaner. Now she works with the robots as a fulfilment centre staff member.

Image caption Jane Colquhoun started as a temporary worker at Amazon

"I've been here since it opened three years ago, when we used to walk around with carts," she says. "It was before the robots. We don't have to do as much walking around now.

"It was scary at first. When you see them you think they're going to hit, but they never have."

Mark Hemming, Amazon's regional operations director, says that despite introducing the robots the company is employing more people.

He says Amazon has added "thousands of jobs year-on-year, at the same time as bringing in technology that helps our employees".

Basic roles still exist, but technology can create new training opportunities and jobs, so it doesn't have to mean fewer staff.

Media playback is unsupported on your device Media caption Instead of humans walking miles to pick goods, these robots take the shelves to the pickers

Another worker, Richard Cowlishaw-Ellison, who is from a former mining village, got a temporary job at Amazon after taking voluntary redundancy from a law firm.

"The firm's now gone," he says. "It was a really tough decision for me. One Christmas I ended up working nights [at Amazon]. Looking back it was the right decision to make, but there were times when I definitely questioned it."

Richard, who now has a permanent job as a senior operations manager, adds: "I guess it's the new conversion to what the mining industry was. It was a big employer back then. Amazon is one of the bigger employers in the region now."

Listen to the full Amazon report from You and Yours at 12:30 GMT.

What's the government doing?

The government has acknowledged the threat automation poses in the north of England.

To ensure no region is left behind, it is giving £9bn to Local Enterprise Partnerships to create opportunities for businesses and communities across the country.

Image copyright HM Government Image caption A number of Enterprise Zones have sprung up, including in Northampton

Since 2012, 48 Enterprise Zones have been established across England, generating more than 38,000 jobs and £3.5bn of private sector investment, according to the government.

Ministers have also started a national retraining scheme which it says will boost people's digital skills and the creation of new jobs.

The Centre for Social Justice has said that businesses should be given financial support to re-skill workers.