A database of every pig’s face. Voice scans that detect hogs with a cough. Robots that dispense just the right amount of feed.

This could be China’s pig farm of the future.

Chinese companies are pushing facial and voice recognition and other advanced technologies as ways to protect the country’s pigs. In this Year of the Pig, many Chinese hogs are dying from a deadly swine disease, threatening the country’s supply of pork, a staple of Chinese dinner tables.

So China’s ebullient technology sector is applying the same techniques it has used to transform Chinese life — and, more darkly, that the Chinese government increasingly uses to spy on its own people — to make sure its pigs are in the pink of health.

“If they are not happy, and not eating well, in some cases you can predict whether the pig is sick,” said Jackson He, chief executive officer of Yingzi Technology, a small firm based in the southern city of Guangzhou that has introduced its vision of a “future pig farm” with facial and voice recognition technologies.