Why Barn Lighting is the Missing Link in Swine Computer Vision

As artificial intelligence enters commercial pig barns, experts say proper illumination is the critical bridge connecting camera optics, stockmanship and animal welfare.

Why-Barn-Lighting-is-the-Missing-Link-in-Swine-Computer-Vision.jpg
(Farm Journal’s Pork)

Precision computer vision in barns is not going away, and many believe it is the key to shifting the pork industry from reactive management to predictive care. When one person is responsible for walking a barn containing thousands of pigs, technology can help identify which pens deserve their attention first.

“Computer vision allows the caretaker to spend more time investigating, making decisions and intervening rather than simply trying to find the problem,” says Courtney Archer, assistant professor in the Department of Animal Sciences at the University of Illinois. “To me, that is where precision livestock technologies become valuable: not replacing the human, but giving the human better information about where and when to act.”

However, simply installing a camera system isn’t enough. A commercial pig barn is an unforgiving environment for sensitive electronics.

“We have to remember where we are asking this technology to live,” Archer points out. “We have pressure washing, humidity, dust, feed dust, ammonia, changing temperatures, pigs bumping equipment, flies, spiderwebs and everything in between.”

On top of environmental wear-and-tear, no two facilities are built the same. Barns differ in pen size, flooring, feeder styles, stocking density, ceiling height, lighting and ventilation.

“A computer vision system cannot assume that what it learned in one research barn will automatically translate perfectly to every commercial facility,” Archer explains. “So we need hardware that is truly barn-ready, but we also need algorithms that can understand the environment they are evaluating. A camera has to distinguish a pig from a feeder, gate, shadow, or another pig lying on top of it. It has to handle animals blocking one another, dirty lenses, changing daylight, different pen configurations, different flooring systems, and differences in pig size and color.”

In other words, the algorithm needs context to understand what is normal for each unique barn—starting with how that space is illuminated.

“Computer vision tools work under the light they were trained on,” explains Erica Bongers, an animal lighting application specialist with Signify Animal Lighting. “Most models were trained under one type of light. If you then change how bright the light is, what color it is, or how evenly it is spread, the image changes. The pig is harder to see against the floor, shadows appear, and the model becomes less sure.”

Normal barn behaviors complicate the picture further. Sometimes pigs lie on top of each other, so some are hidden. Dust or a fly on the lens can look like a pig. And, when two pigs walk past each other, the model can mix them up, Bongers adds.

Between pig biology, barn-tough camera optics and daily barn management, lighting has emerged as the critical foundation where animal welfare, labor efficiency and smart technology converge.

The Case for Better Lighting Beyond Technology

Pigs see the world quite differently than humans do, Bongers points out. A barn that looks well lit to human eyes is not necessarily well lit for swine.

“What we want is nature-inspired light in modern barns, so the animals stay healthy and the farmer stays productive,” she says.

A pig’s eyes possess two types of color receptors: one for blue light (439 nanometers) and one for green (556 nanometers). Compared to humans, pigs are essentially red-green color blind and perceive far less detail, relying heavily on contrast and motion.

“Light helps pigs read each other,” Bongers says. “Pigs know each other by sight, so light that is too low or badly spread makes that harder. Bright spots and hard shadows can make pigs restless.”

Lighting in a Pig Barn
(Signify Animal Lighting)

Biological cycles are equally sensitive. Melatonin, the sleep hormone, rises in darkness, while cortisol, the wake-and-stress hormone, spikes when lights flip on. That is why leaving lights on 24/7 disrupts welfare, and why snapping fixtures on abruptly can startle an entire room.

“Lighting is more important than we give it credit for because light helps establish the animal’s daily behavioral rhythm,” Archer says. “Pigs are diurnal animals, so providing a defined light period and dark period allows them to develop a relatively predictable daily schedule. They learn when the barn ‘day’ begins, when feeding and human activity tend to occur, and when the environment becomes quiet. And really, none of us would be thrilled if someone left the lights on over our heads 24 hours a day either.”

In a tail-biting study Archer completed, pigs were maintained on a predictable 7 a.m. to 3 p.m. photoperiod. A clear baseline quickly emerged: pigs rested during the dark period and concentrated activity during illuminated hours.

“That predictable schedule was actually very useful scientifically because we could then examine when behaviors were occurring, not simply whether they occurred,” Archer says. “We were able to look at how tail-directed behavior and tail biting changed throughout the day and identify periods when those behaviors were more or less likely to occur.”

Predictable Light Creates Manageable Behavior

While lighting adjustments alone cannot solve multifaceted issues like tail biting or disease outbreaks, consistent schedules turn daily behavior into a practical management tool.

“If providing a consistent light-dark cycle helps create predictable patterns of behavior, and we learn that certain unwanted behaviors are more likely to occur during particular periods of the day, then we can adjust management around those patterns,” Archer says. “Instead of reacting after a problem occurs, we can begin asking, ‘When is this most likely to happen, and what can we do before we get there?’”

If producers know tail-directed behavior spikes during a specific window, caretakers can introduce enrichment, increase pen walks, or intervene before aggression escalates.

“The exact intervention will depend on the behavior and production system, but the larger point is that predictable behavior gives us something we can manage around,” Archer says. “That is why I think lighting goes beyond simply providing pigs with a period of light and a period of darkness. A consistent photoperiod helps establish a predictable behavioral environment, and that predictability can become useful information for management.”

Why Barn Lighting is the Missing Link in Swine Computer Vision.jpg

Animal Behavior is a Warning Tool

Behavior is more than just interesting to observe—it is an animal’s primary way of communicating its internal state and reactions to its environment. While a single movement doesn’t tell the whole story, broad behavioral patterns reveal significant shifts in health and comfort.

“When we combine behavioral, chemical, physiological and environmental information, we may be able to develop a much stronger early-warning system,” Archers says. “That is where I think computer vision becomes especially powerful.”

Continuous camera monitoring objectively tracks postures, feeding habits and activity around the clock without requiring constant human presence.

“I often describe it as giving the caretaker another set of eyes that never has to leave the barn,” Archer says. “But those eyes still need a brain behind them. Computer vision should not replace stockmanship. It should help a good stockperson recognize that something is changing sooner, know where to look, and make a better management decision.”

Turning Data into Practical Decisions

For camera systems to achieve widespread adoption, they must adapt to the commercial farm rather than requiring the farm to adapt to them.

“Ideally, we should be able to install a system in a facility, allow it to learn the environment and establish what normal looks like there, and then identify meaningful deviations from that baseline,” she says.

Equally vital is avoiding data overload.

“Producers do not need another system producing thousands of data points every day,” Archer says. “They need something that turns those data into a useful management decision. Ideally, the system says, ‘Something changed in this pen,’ or ‘These three pigs are behaving differently than expected,’ and gives the caretaker a reason to go look.”

Factors like equipment durability, connectivity, integration with existing barn controls, and demonstrated return on investment will dictate how quickly these tools become standard practice.

At the same time, Bongers emphasizes that objective measuring tools should encourage producers—and technology providers—to remain grounded.

“We can record what light really does to pigs on a working farm,” Bongers says. “That should make everybody more careful with claims, us included. Be careful with anyone who says that a lamp stops tail biting or improves average daily gain. The trials did not show that from light level or light color on their own.”

Fortunately, producers do not need advanced computer vision cameras to begin improving their barn lighting today.

“Give the pigs a real dark period,” Bongers advises. “Measure the light at pig height in every part of the pen, not one average. Dim slowly instead of switching the light straight on and off. Replace lamps that flicker.”

Ultimately, whether through an automated camera lens or the experienced eye of a stockperson, the value of barn management lies in early action. By aligning smart illumination with consistent animal rhythms, producers can move away from asking what went wrong and toward acting on what the pigs are telling them before a problem starts.

Pork Daily Trusted by 14,000+ pork producers nationwide. Get the latest pork industry news and insights delivered straight to your inbox.
Read Next
Five years after her late brother, Levi, won grand champion, 12-year-old Lynnox Tysinger honored his memory with an emotional victory in the exact same show ring, leaning on the family’s rule to “just keep driving.”
Get News Daily
Get Markets Alerts
Get News & Markets App