Skip to content
Barry Smart By Barry Smart Director of Data & AI
Do robots dream of counting sheep?

TLDR; the title of this blog is a take on the name of the book that inspired the Blade Runner movies "Do Androids Dream of Electric Sheep" written in 1968 by Philip K. Dick. In my case, I was inspired during a weekend helping out on the farm to think about the increasing use of AI in all walks of life. My thought experiment considers the situations in which it makes most sense to apply AI. I also consider the pitfalls and challenges that often come with digitally transforming business processes that have, up until now, remain unchanged for tens, possibly even hundreds of years.

A few weekends ago, I was drafted in along with my wife and a few other family members to help out at my father-in-law's farm. The job was to scan over 300 pregnant sheep to determine how many lambs each was carrying.

Discover your Power BI Maturity Score by taking our FREE 5 minute quiz.

With lambing due to start in the next few months, this data is useful as it allows the shepherd to feed the pregnant sheep appropriately based on the number of lambs they are carrying. Furthermore, ewes that are carrying triplets are likely to need help during birth, so they can be brought indoors and kept under closer observation. A great example of a data driven business!

Over 300 pregnant sheep waiting to be scanned.

The job of scanning each sheep is skilled and requires specialist equipment, so an external contractor is usually brought in. In this case a chap called Stuart Wright who is extremely busy at this time of year scanning sheep at farms all over Scotland.

As a free unskilled labourer, my job was to encourage the sheep to move through the fank and ultimately to get scanned by Stuart. My father-in-law maintained that I should be paying him for organising such excellent "weekend entertainment"!

Stuart had a purpose built trailer to help him do his job: it provided a narrow race through which only one sheep at a time could pass and a covered area kept dark so that he could read the screen on the ultrasound device easily. Stuart sat on a low level seat so he could easily reach the belly of each sheep with his ultrasonic transceiver and with his foot he operated gate to let each sheep out after it has been scanned. A lot of multi-tasking!

Custom built trailer for scanning sheep.

The trailer was a great example of simple "no frills" engineering to solve a real problem. As you can see from the photo above, this was all about functionality not aesthetics. It was focused on one objective: to enable as many sheep to be scanned in as short a space of time as possible, safely and with minimum effort

Stuart also explained how the design of his trailer had evolved over time: based on the experience of using it "in the field" adjustments in the design had been made accordingly. A great example of the Lean Startup Build-Measure-Learn feedback loop in action!

Programming C# 10 Book, by Ian Griffiths, published by O'Reilly Media, is now available to buy.

The counting sheep thought experiment

Farming is the world's oldest industry, and up until now, it has largely escaped the digital disruption we have seen in other industries. However there are an increasing range of innovative data driven initiatives in the sector such as Microsoft's recently announced partnership a dairy cooperative in America to use technology such as cloud connected pedometers to track the wellbeing of cows. Or a cloud platform called Azure FarmBeats that applies AI, IoT and edge computing to agriculture to turn data sources such as satellite or drone imagery and data from soil sensors into actionable insights for farmers.

Whilst I was providing my free labour, I was watching Stuart scanning each sheep - about one every 5 to 10 seconds. I got to thinking: is this a task that could be carried out by a machine? Is sheep scanning the next big opportunity for AI?

I asked Stuart. He thought not. He cited complexities such as the need to dynamically adjust the position of the transceiver on a moving subject (unlike their human counterparts, the sheep do not stay still when they are being scanned!) and the skill in picking out the forms of the unborn lambs from the noisy constantly shifting ultrasound readout. See photo below of Stuart (inside te trailer) scanning a sheep:

Scanning in progress.

My own thoughts were that an intelligent agent probably could be developed to do this job. The "task environment" for this intelligent agent, defined using the PEAS acronym, would present some challenges but it was not at the "extremely difficult" end of the spectrum:

  • Performance measure - this was clear and easily quantified: to scan as many sheep as possible in as short a space of time as possible, with maximum accuracy and without harming any of the sheep. So the effectiveness of any intelligent agent could be measured and a feedback loop created for techniques such as reinforcement learning;
  • Environment - this was no doubt a challenging environment in which to operate am AI. It would be classified as a dynamic, competitive multiagent (robot versus wriggling sheep) environment in which there was a degree of uncertainty involved. However it was also simplified by it being a "known" environment, that was fully observable (via the sensors, see below) and the task being episodic in nature;
  • Actuators - are readily available to perform this task such as robot arm to position the transceiver and pneumatics to open and close the gates;
  • Sensors - proven technology is also available to enable the AI to constantly assess the environment through devices such as proximity sensors and cameras to detect the presence of a sheep.

Indeed there are already a number of precedents for this type of intelligent agent in farming. The most compelling being robot milking in dairy farms. In this video report from the BBC "Robot milking saved my dairy farm", farmer Neale Sadler talks about the positive experience he has had using robot milking for the last 13 years:

  • He has happier / healthier cows - they find robot milking is less stressful and they choose when they want to be milked;
  • Neale believes that the robot has enabled him to become a better farmer by freeing him up from the repetitive, time consuming task of milking (8 hours per day) to focus on higher value work;
  • He also talks about how the data generated from the robot milker allows him to monitor the process (even from the beach!) and make more proactive decisions about looking after his herd. A fantastic example of using data for good.

A great example of digital transformation having an all round positive impact.

Other points worth noting from this video:

  • Neale did his research - he went to see the technology in use in other farms before committing to it. Sound advice for any strategic technology investment - seek out reference customers and talk to them about their experiences before committing;
  • The software that runs the robot is constantly being updated by the product vendor Lely so he gains benefit from buying into a product based solution as opposed to developing a bespoke solution of his own, sounds advice for any technology investment and the mantra "buy before build";
  • Neale makes the point that this is "not for everybody" - you have to be prepared to change how you work to get the most out of the technology. This reminds me of endjin's "organisational readiness assessment" that we run as part of our modern data platform engagements: there are many factors beyond the technology that are key to the success of technology project including things like culture, training, operating model and governance.

Ask not "can you build it?" but "should you build it?"

So going back to Stuart's sheep scanning job - is he going to be displaced by a machine any time soon? It was time to apply some commercial reality to my thought experiment: asking not "can it be built?" but "does it make commercial sense to build it?". Another question that surprisingly many organisations fail to ask before embarking on large technology investments.

Stuart is paid based on a fixed a fee per sheep scanned. So the more sheep he could scan in an day, the more he could earn.

Firstly, it was difficult to see how AI could drastically increase the daily capacity by the order of magnitude often required to make such an investment worthwhile: i.e. scanning one sheep every 1 second (rather than every 10 seconds). Furthermore, even if the technology could allow him to scale up to this degree, it is clear that other factors come into play that would constrain the business model:

  • The total accessible market is small and static - there is insufficient capacity in the market to generate an RoI on the investment required to develop the technology;
  • The work is seasonal - so there is limited time over which to derive value from the technology;
  • The service is constrained to physical channels - therefore the time required to transport the equipment and set up at each farm becomes the limiting factor on scaling up. So it would be impossible to exploit the economies of scale that enable digital services to drive the cost to serve towards zero and achieve exponential growth.

So my conclusion was that Stuart's job was probably safe for the foreseeable future!

Overview of scanning in action.

However, I thought there were potentially smaller parts of the end to end value chain that could benefit from the application of technology:

  • Image recognition built into the ultrasound device to determine the number of lambs being carried by each sheep, acting as a second pair of eyes?
  • Automated logging of the results, linked to the RFID tag on each sheep to generate an electronic log of the sheep's pregnancy. This could also be used to keep a log of the number of sheep scanned and drive charging for the services via paperless invoicing and payment, minimising admin effort for all parties?
  • Setting up an online booking system that enables farms to request the service, appointments to be coordinated by geographic area and routes established that will minimise travel costs and emissions?

These are all examples of repurposing technologies that have been proven in other areas and applying them to a new process. This type of incremental, low cost, low risk investment seems a more realistic way to "digitally transform" this particular process.

Focus on small tasks ripe for automation

Indeed the application of AI to make small incremental improvements in this way is often the best way to deliver maximum impact. Andrew Ng, a world renowned expert in AI believes:

"If a typical person can do a mental task with less than one second of thought, we can automate it using AI."

I would agree, in particular if that task is repetitive in nature. So it's about finding the parts of the business process where technology can deliver maximum impact and using this to incrementally transform the way that people work. Howard van Rooijen demonstrated the power of this philosophy in his blog by using Azure to deliver a series of micro-optimisations that collectively transformed the process of identifying and accounting for business expenses.

So what one second tasks should we target with this micro-optimisation approach? Part of the answer is that we need to recognise the relative strengths of humans and machines:

  • Human will continue to prevail in areas such as creativity, applying judgement, social and leadership skills;
  • Machines will excel at speed, accuracy, predictive capabilities and scalability.

Whilst certain jobs (or tasks within a job) will be exclusive to either humans or machines based on these strengths, experts also predict that new jobs will emerge based on humans and machines working together.

A recent example of this was when Elon Musk, when facing significant delays in production of his Model 3 Tesla, admitted "Yes, excessive automation at Tesla was a mistake. To be precise, my mistake. Humans are underrated.". It was not until he reintroduced humans to his production line to work alongside the machines that he achieved the level of productivity needed to keep his business on track.

The experts imagine two broad categories of human-machine symbiosis:

  • Firstly, where machines reach out to humans for support. For example when judgement is required. Here humans are working along side the machine to sustain the effectiveness of the process over the long term by continuing to provide inputs that train or calibrate the machine.
  • Secondly, where humans reach out to machines to get their help in some way. Typically to augment and amplify their own capabilities so they can approach the task with “superhuman” powers.

The barrier is often people not technology

This brought me onto my final thought. What I find is that the barrier to successful digital transformation is more often the people, not the technology. I have had experiences during my career where people have actively resisted adoption of a new technology based on their own personal motivations, or a silo mentality, rather than based on the greater good. This has resulted in projects stalling, or in extreme cases failing altogether.

But even when people are open minded, they can often find the impact uncomfortable. For example, a couple of years ago, I met a finance manager at a global technology firm who had a significant proportion of his role replaced by a machine learning algorithm. That algorithm had been proven to consistently produce more accurate financial forecasts than he and his team could. As a result, he had to adapt his role to work with the machine. This was not something that he had found comfortable at the time. But having worked through the change, he now admitted his new role was more rewarding because he was now freed up to focus on higher value tasks.

Businesses are turning more to technology to survive in an increasingly digital world. So technology professionals are frequently finding themselves in situations where skills that they are not traditionally experienced in (such as communications and change management) are becoming critical.

How can we as technology professionals meet these challenges and avoid the stress that digital transformation can often bring to others and indeed ourselves? How can we make the impact of digital transformation a good experience for the people that it impacts?

In my experience the projects that have managed to address this have had the following common attributes:

  • Business led - practitioners seconded full time onto the project to lead the change rather than having the change "done to them".
  • Multi-disciplinary - recognition that a broad set of skills are required to achieve success, so building a team that covers all of the skills from communications and change management all the way through to deep technical end of the spectrum is key.


Will machines eventually replace humans? I don't believe so, machines will enable humans to do more valuable tasks and new jobs will emerge based on humans and machines working in partnership.

Barry Smart

Director of Data & AI

Barry Smart

Barry has spent over 25 years in the tech industry; from developer to solution architect, business transformation manager to IT Director, and CTO of a £100m FinTech company. In 2020 Barry's passion for data and analytics led him to gain an MSc in Artificial Intelligence and Applications.