ZHENGZHOU, China — In the Chinese city of Zhengzhou, a police officer wearing facial recognition glasses spotted a heroin smuggler at a train station.
In Qingdao, a city famous for its German colonial heritage, cameras powered by artificial intelligence helped the police snatch two dozen criminal suspects in the midst of a big annual beer festival.
In Wuhu, a fugitive murder suspect was identified by a camera as he bought food from a street vendor.
With millions of cameras and billions of lines of code, China is building a high-tech authoritarian future. Beijing is embracing technologies like facial recognition and artificial intelligence to identify and track 1.4 billion people. It wants to assemble a vast and unprecedented national surveillance system, with crucial help from its thriving technology industry.
"In the past, it was all about instinct," said Shan Jun, the deputy chief of the police at the railway station in Zhengzhou, where the heroin smuggler was caught. "If you missed something, you missed it."
China is reversing the commonly held vision of technology as a great democratizer, bringing people more freedom and connecting them to the world. In China, it has brought control.
Megvii employees at the company's offices in Beijing.CreditGilles Sabrié for The New York Times
In some cities, cameras scan train stations for China's most wanted. Billboard-sized displays show the faces of jaywalkers and list the names of people who can't pay their debts. Facial recognition scanners guard the entrances to housing complexes. Already, China has an estimated 200 million surveillance cameras — four times as many as the United States.
Such efforts supplement other systems that track internet use and communications, hotel stays, train and plane trips and even car travel in some places.
Even so, China's ambitions outstrip its abilities. Technology in place at one train station or crosswalk may be lacking in another city, or even the next block over. Bureaucratic inefficiencies prevent creation of a nationwide network.
For the Communist Party, that may not matter. Far from hiding their efforts, Chinese authorities regularly state, and overstate, their capabilities. In China, even the perception of surveillance can keep the public in line.
Some places are further along than others. Invasive mass-surveillance software has been set up in the west to track members of the Uighur Muslim minority and map their relations with friends and family, according to software viewed by The New York Times.
"This is potentially a totally new way for the government to manage the economy and society," said Martin Chorzempa, a fellow at the Peterson Institute for International Economics.
"The goal is algorithmic governance," he added.
Police officers wearing A.I.-powered smart glasses in Luoyang.CreditReuters
The intersection south of Changhong Bridge in the city of Xiangyang used to be a nightmare. Cars drove fast and jaywalkers darted into the street.
Then last summer, the police put up cameras linked to facial recognition technology and a big, outdoor screen. Photos of lawbreakers were displayed alongside their name and government I.D. number. People were initially excited to see their faces on the board, said Guan Yue, a spokeswoman, until propaganda outlets told them it was punishment.
"If you are captured by the system and you don't see it, your neighbors or colleagues will, and they will gossip about it," she said. "That's too embarrassing for people to take."
China's new surveillance is based on an old idea: Only strong authority can bring order to a turbulent country. Mao Zedong took that philosophy to devastating ends, as his top-down rule brought famine and then the Cultural Revolution.
His successors also craved order but feared the consequences of totalitarian rule. They formed a new understanding with the Chinese people. In exchange for political impotence, they would be mostly left alone and allowed to get rich.
It worked. Censorship and police powers remained strong, but China's people still found more freedom. That new attitude helped usher in decades of breakneck economic growth.
Today, that unwritten agreement is breaking down.
China's economy isn't growing at the same pace. It suffers from a severe wealth gap. After four decades of fatter paychecks and better living, its people have higher expectations.
Tourists waiting to visit the Mao Mausoleum in Beijing, under a pole holding 11 surveillance cameras.CreditGilles Sabrié for The New York Times
Xi Jinping, China's top leader, has moved to solidify his power. Changes to Chinese law mean he could rule longer than any leader since Mao. And he has undertaken a broad corruption crackdown that could make him plenty of enemies.
For support, he has turned to the Mao-era beliefs in the importance of a cult of personality and the role of the Communist Party in everyday life. Technology gives him the power to make it happen.
" Reform and opening has already failed, but no one dares to say it," said Chinese historian Zhang Lifan, citing China's four-decade post-Mao policy. "The current system has created severe social and economic segregation. So now the rulers use the taxpayers' money to monitor the taxpayers."
Mr. Xi has launched a major upgrade of the Chinese surveillance state. China has become the world's biggest market for security and surveillance technology, with analysts estimating the country will have almost 300 million cameras installed by 2020. Chinese buyers will snap up more than three-quarters of all servers designed to scan video footage for faces, predicts IHS Markit, a research firm. China's police will spend an additional $30 billion in the coming years on techno-enabled snooping, according to one expert quoted in state media.
Government contracts are fueling research and development into technologies that track faces, clothing and even a person's gait. Experimental gadgets, like facial-recognition glasses, have begun to appear.
Judging public Chinese reaction can be difficult in a country where the news media is controlled by the government. Still, so far the average Chinese citizen appears to show little concern. Erratic enforcement of laws against everything from speeding to assault means the long arm of China's authoritarian government can feel remote from everyday life. As a result, many cheer on new attempts at law and order.
"It's one of the biggest intersections in the city," said Wang Fukang, a college student who volunteered as a guard at the crosswalk in Xiangyang. "It's important that it stays safe and orderly."
At the Shanghai headquarters of the artificial intelligence start-up Yitu, a network of cameras linked to a facial recognition system monitors employees and can track their movements in the office.CreditGilles Sabrié for The New York Times
Start-ups often make a point of insisting their employees use their technology. In Shanghai, a company called Yitu has taken that to the extreme.
The halls of its offices are dotted with cameras, looking for faces. From desk to break room to exit, employees' paths are traced on a television screen with blue dotted lines. The monitor shows their comings and goings, all day, everyday.
In China, snooping is becoming big business. As the country spends heavily on surveillance, a new generation of start-ups have risen to meet the demand.
Chinese companies are developing globally competitive applications like image and voice recognition. Yitu took first place in a 2017 open contest for facial recognition algorithms held by the United States government's Office of the Director of National Intelligence. A number of other Chinese companies also scored well.
A technology boom in China is helping the government's surveillance ambitions. In sheer scale and investment, China already rivals Silicon Valley. Between the government and eager investors, surveillance start-ups have access to plenty of money and other resources.
In May, the upstart A.I. company SenseTime raised $620 million, giving it a valuation of about $4.5 billion. Yitu raised $200 million last month. Another rival, Megvii, raised $460 million from investors that included a state-backed fund created by China's top leadership.
At a conference in May at an upscale hotel in Beijing, China's security-industrial complex offered its vision of the future. Companies big and small showed off facial-recognition security gates and systems that track cars around cities to local government officials, tech executives and investors.
Private companies see big potential in China's surveillance build-out. China's public security market was valued at more than $80 billion last year but could be worth even more as the country builds its capabilities, said Shen Xinyang, a former Google data scientist who is now chief technology officer of Eyecool, a start-up.
"Artificial intelligence for public security is actually still a very insignificant portion of the whole market," he said, pointing out that most equipment currently in use was "nonintelligent."
Many of these businesses are already providing data to the government.
Mr. Shen told the group that his company had surveillance systems at more than 20 airports and train stations, which had helped catch 1,000 criminals. Eyecool, he said, is also handing over two million facial images each day to a burgeoning big-data police system called Skynet.
At a building complex in Xiangyang, a facial-recognition system set up to let residents quickly through security gates adds to the police's collection of photos of local residents, according to local Chinese Communist Party officials.
Wen Yangli, an executive at Number 1 Community, which makes the product, said the company is at work on other applications. One would detect when crowds of people are clashing. Another would allow police to use virtual maps of buildings to find out who lives where.
China's surveillance companies are also looking to test the appetite for high-tech surveillance abroad. Yitu says it has been expanding overseas, with plans to increase business in regions like Southeast Asia and the Middle East.
At home, China is preparing its people for next-level surveillance technology. A recent state-media propaganda film called "Amazing China" showed off a similar virtual map that provided police with records of utility use, saying it could be used for predictive policing.
"If there are anomalies, the system sends an alert," a narrator says, as Chinese police officers pay a visit to an apartment with a record of erratic utility use. The film then quotes one of the officers: "No matter which corner you escape to, we'll bring you to justice."
A video showing facial recognition software in use at the Megvii showroom in Beijing.CreditGilles Sabrié for The New York Times
For technology to be effective, it doesn't always have to work. Take China's facial-recognition glasses.
Police in the central Chinese city of Zhengzhou recently showed off the specs at a high-speed rail station for state media and others. They snapped photos of a policewoman peering from behind the shaded lenses.
But the glasses work only if the target stands still for several seconds. They have been used mostly to check travelers for fake identifications.
China's national database of individuals it has flagged for watching — including suspected terrorists, criminals, drug traffickers, political activists and others — includes 20 million to 30 million people, said one technology executive who works closely with the government. That is too many people for today's facial recognition technology to parse, said the executive, who asked not to be identified because the information wasn't public.
The system remains more of a digital patchwork than an all-seeing technological network. Many files still aren't digitized, and others are on mismatched spreadsheets that can't be easily reconciled. Systems that police hope will someday be powered by A.I. are currently run by teams of people sorting through photos and data the old-fashioned way.
Take, for example, the crosswalk in Xiangyang. The images don't appear instantaneously. The billboard often shows jaywalkers from weeks ago, though recently authorities have reduced the lag to about five or six days. Officials said humans still sift through the images to match them to people's identities.
Still, Chinese authorities who are generally mum about security have embarked on a campaign to convince the country's people that the high-tech security state is already in place.
China's propagandists are fond of stories in which police use facial recognition to spot wanted criminals at events. An article in the People's Daily, the Communist Party's official newspaper, covered a series of arrests made with the aid of facial recognition at concerts of the pop star Jackie Cheung. The piece referenced some of the singer's lyrics: "You are a boundless net of love that easily trapped me."
In many places, it works. At the intersection in Xiangyang, jaywalking has decreased. At the building complex where Number 1 Community's facial-recognition gate system has been installed, a problem with bike theft ceased entirely, according to building management.
An outdoor screen in Xiangyang displays photos of jaywalkers alongside their names and I.D. numbers. The idea is to embarrass offenders into compliance.CreditGilles Sabrié for The New York Times
"The whole point is that people don't know if they're being monitored, and that uncertainty makes people more obedient," said Mr. Chorzempa, the Peterson Institute fellow.
He described the approach as a panopticon, the idea that people will follow the rules precisely because they don't know whether they are being watched.
In Zhengzhou, police were happy to explain how just the thought of the facial recognition glasses could get criminals to confess.
Mr. Shan, the Zhengzhou railway station deputy police chief, cited the time his department grabbed a heroin smuggler. While questioning the suspect, Mr. Shan said, police pulled out the glasses and told the man that what he said didn't matter. The glasses could give them all the information they needed.
"Because he was afraid of being found out by the advanced technology, he confessed," said Mr. Shan, adding that the suspect had swallowed 60 small packs of heroin.
"We didn't even use any interrogation techniques," Mr. Shan said. "He simply gave it all up."
Carolyn Zhang contributed reporting from Zhengzhou.