A few days ago, I was having a discussion with a friend about computer vision.

We were reminiscing about what it was like to build an object detector 12 years ago. Face recognition at the time was already pretty good, but when digging into anything new, you pretty much had to spend days collecting and labelling images, and then testing, adjusting, and repeating. Not to mention the time spent digging through bugs to figure out why the training wouldn’t start, etc. At least that was my experience back then.

I made a fairly bold claim:

Give me 15 minutes and I can go from zero to detecting cows on my Mac today.

It's easy to throw out such statements. So I decided to measure it rather than just speculate.

I opened Claude Code with its default Opus 5.5, created a GitHub repo, and gave GPT a rough prompt to engineer a more detailed one for Claude Code. No hand-written detection code, no custom training set. The agent was free to pick the tools and models.

I wasn't worried whether AI could detect cows; there are pretrained object detectors, and I was pretty sure that when stating "state-of-the-art", YOLO would be there. And surprise—it was! My aim was to see how quickly it could create a whole project around it, so I could pretty much install the Python requirements, provide an input photo, and see an annotated output.

The experiment in numbers:

Cow detection in photographs - 20 minutes and 6 seconds. Spent 80k tokens. I got a CLI, bounding boxes, JSON output, benchmarks and validation tooling.

Video tracking and movement classification - 56 minutes and 7 seconds. Spent 170k tokens. I got an initial video-analysis implementation, which was pretty decent but would need further refinement.

That's roughly an hour and a half to reach a working image detector and detect cow movement from a drone video. And the latter includes the time I spent prompting the LLMs.

For reference, the token figures are approximate and might vary from device to device.

Stage 1: "Find the cows"

My initial prompt was primarily to detect cows in an image, draw rectangles around them, count them, and then return a structured JSON file with the output picture. I also asked for performance parameters and accuracy measurements.

I intentionally did not tell it to use YOLO or that it would have to consider picture sizes or any architectural constraints. Making those decisions was one of the assignments for Claude.

Claude went with a pretrained YOLO26-x detector, implemented a Python command-line application, output images and JSON, and built a proper validation workflow with tests. It did evaluate alternative models in its workflow as well and documented its findings. In fact, it spent more time documenting and benchmarking than needed for this little experiment. Useful, but I guess that's where the extra time went.

I only missed my estimate by 5 minutes and 6 seconds

But the results were good—the repo reports the following results for the default detector on the COCO val2017 cow subset:

Metric Result
Evaluation set 87 photographs, 372 annotated cows and 8 crowd regions
Precision (IoU ≥ 0.5, confidence 0.25) 91.7%
Recall (IoU ≥ 0.5, confidence 0.25) 82.8%
F1 score 87.0%
Average absolute counting error 0.56 cows/image (95% CI: 0.36–0.79)
Images counted exactly 65.8% of the 79 crowd-free images
Typical inference time ~24–25 ms per 640×480 image on Apple M4 Max (MPS)

Those numbers are more meaningful than saying "it looks accurate". It also doesn’t mean it will be 91.7% precise on any new dairy or beef farm. COCO images and drone images are very different environments, and to achieve broad coverage, the model will most likely need further training.

My hardware was an Apple M4 Max, and the reported inference timings exclude the longer process of writing and testing the code. They're separate measurements for separate questions.

Show the exact first prompt
You are a senior computer vision engineer. I want you to develop a Python application that detects and counts cows in photographs, using the best practical state-of-the-art computer vision methodology available today. **Requirements:** 1. Accept an image file as a command-line argument. 2. Detect all visible cows in the image. 3. Generate an annotated image showing bounding boxes and individual cow IDs. 4. Output a JSON file containing the total cow count, bounding-box coordinates and detection confidence for every cow. 5. Support multiple cows, partial occlusions and varying distances. 6. Use an existing pretrained model where appropriate. Do not train a model from scratch unless necessary. 7. Choose and explain your model and architecture, including limitations. 8. Provide installation instructions, dependency versions and a reproducible execution command. 9. Report inference time separately from model loading and initialization time. 10. Do not claim accuracy without validation against ground truth. You are free to choose libraries, models and implementation techniques. Prefer a robust, maintainable solution over unnecessarily complex code. This is the first stage of a progressively more advanced computer vision experiment. Deliver a working Stage 1 implementation and explain how to run and validate it. I've also created a repository for you to use https://github.com/xMKx/cattle-monitoring.git 

Stage 1.5: The drone-photo reality check

Obviously, I couldn't let Claude decide which images were great (like the one seen on GitHub). I searched the internet and gave it the following image:

Oblique aerial photo of a large herd, before detection

Initial output:

Initial annotated output with 26 detected cows

Of course, I prompted Claude to see that this detection was poor, and ironically, it agreed that the picture should have around 150 cows in it. So it created a new preset called aerial. After that, the output for the same image was:

Refined annotated output with 150 detected cows

Huge improvement, but of course, I wasn't satisfied with the results and threw photo3 into the equation (also available on GitHub). Unfortunately, it wasn't that efficient on that one:

One annotated result on the dense herd photo

Not good at all, but the comparison tells us something genuinely useful: a configuration that looks excellent from one drone angle can fail almost completely from another.

This isn't just a problem of insufficient pixels. It's also a training-data and viewpoint problem—what CV engineers call domain shift. For a detection model, different positions, angles, and views of cows will be interpreted completely differently, and that's where the extra work for getting production-level software will go.

Stage 2: Now make it understand video

Now that we've got a detector in around half an hour, the next logical question, of course, is: can we do video analysis?

Sounds easy, but it used to be a tough assignment in the past, and the complexity increases exponentially. The detector has to examine video frames separately, and there needs to be a tracker to understand which cow is which. They can disappear and cross paths, etc.

My next input was a cutout from a Halter drone video, and my idea was that Claude Code should now enhance this solution to detect cows in video and classify them as MOVING, STATIONARY or UNKNOWN.

The funky twist is that the drone can move too. A stationary cow will shift across the image when the camera changes position. So bounding-box movement alone is not enough—the application needs some way to estimate movement relative to the ground rather than relative to the camera.

So the implementation has to combine the following moving parts:

  • Object detection on video frames.
  • Persistent IDs and multi-object tracking across frames.
  • Handling occlusion and lost tracks.
  • Camera-motion compensation and temporal smoothing.
  • Movement-state classification and uncertainty.
  • Annotated video, machine-readable results and performance measurement.

I gave Claude Code a much longer, comprehensive prompt, leaving the algorithmic choices to the agent. It used approximately 170,000 tokens in this stage.

Show the full video-analysis prompt
# Stage 2 — Cattle Video Detection, Tracking and Activity Recognition You are a senior computer vision and machine learning engineer specialising in object detection, multi-object tracking, motion analysis and animal behaviour recognition. We are continuing the cattle-monitoring application developed in this repository. There is a video file named `halter.mov` in the project directory. It contains drone footage of a herd of cattle. Your task is to independently research, select and implement a state-of-the-art computer vision pipeline that can detect individual cows, track them throughout the video, and classify whether each cow is **MOVING** or **STATIONARY**. The objective is to produce a working, accurate and reasonably efficient application using modern pretrained models and tracking algorithms. **You have autonomy over the technical approach.** Select the models, tracking methods, computer vision techniques and libraries you consider most appropriate. Explain your choices and their trade-offs, but prioritise a working implementation over extensive documentation. ## 1. Video processing and cow detection - Accept a video file as input via a Python command-line interface. - Automatically determine video resolution, frame rate, duration and total frame count. - Detect visible cows in every processed frame. - Support large herds, small distant cattle, overlapping animals, partial occlusions and changes in apparent scale. - Reuse the existing image-detection implementation where appropriate, but evaluate whether it is optimal for video. - Use pretrained models unless fine-tuning is demonstrably necessary. - Avoid unnecessary duplicate processing and minimise inference overhead. ## 2. Multi-object tracking Implement persistent identification of individual cows throughout the video. Each detected cow should receive a unique tracking ID, which should remain consistent between frames. The tracking solution should: - Associate detections across consecutive frames. - Preserve IDs through short occlusions and temporary detection failures. - Handle cattle entering and leaving the frame. - Minimise identity switches and duplicate tracks. - Handle animals crossing paths or moving close together. - Avoid interpreting a temporarily lost animal as a new cow without justification. Investigate modern tracking approaches and select the most suitable one for aerial cattle footage. Report both the number of cows currently visible and the estimated number of unique cows observed throughout the video. Do not present the latter as a validated count if tracking errors could inflate it. ## 3. Activity recognition — MOVING versus STATIONARY For every tracked cow, determine whether it is moving or stationary. **Critical consideration: the video is captured from a drone that may itself move.** Simply measuring the displacement of a cow's bounding box between frames is insufficient, because a stationary cow may appear to move when the drone moves. Develop a method for distinguishing animal movement from camera movement. Consider: - Camera-motion estimation and compensation. - Background feature tracking or geometric registration. - Perspective and apparent scale changes. - Ground-relative displacement. - Temporal smoothing across multiple frames. - Adaptive movement thresholds based on detection scale and video resolution. - Confidence and uncertainty of activity classification. The classification should represent actual movement relative to the ground, not movement relative to the camera. Use at least these states: - `MOVING` — sufficient evidence that the cow is changing location. - `STATIONARY` — sufficient evidence that the cow remains in approximately the same location. - `UNKNOWN` — insufficient evidence to classify reliably. Avoid rapid switching between states due to detection noise. Do not equate STATIONARY with standing posture. A stationary cow could be grazing, resting or lying down. If more detailed behaviour recognition is practical without significantly complicating the application, you may propose it as an extension, but focus on getting movement classification correct first. ## 4. Annotated video output Generate an annotated copy of the original video containing: **For each cow:** - Bounding box. - Persistent tracking ID. - Current activity state. - Colour-coded visual indication of activity. - Optional short movement trajectory. **Overlay summary:** - Total cows currently detected. - Currently moving cows. - Currently stationary cows. - Cows with uncertain activity. - Estimated number of unique cows tracked. - Video timestamp. Maintain readable annotations even when many cows are visible. Preserve the original frame dimensions and playback speed wherever practical. ## 5. Structured results Generate machine-readable JSON containing: **Video metadata:** - Filename. - Duration. - Resolution. - Original and processed FPS. - Processing time. - Model and tracker identifiers. **Per-frame observations:** - Frame number and timestamp. - Individual cow tracking IDs. - Bounding-box coordinates. - Detection confidence. - Activity state and confidence, where meaningful. - Estimated ground-relative movement. **Per-track statistics:** - Tracking ID. - First and last observation timestamps. - Number of observed frames. - Total moving and stationary durations. - Movement trajectory or motion measurements. - Tracking interruptions and uncertainty indicators. Provide an aggregate summary of movement patterns throughout the video. Do not invent physical distances or speeds in metres unless the video provides sufficient information for valid scale calibration. ## 6. Performance and efficiency Aim for a practical implementation that can process video efficiently on the available hardware. - Detect available compute capabilities automatically. - Use GPU acceleration where supported. - Implement batching or frame subsampling where beneficial. - Avoid unnecessary repeated model initialisation. - Preserve correct timestamps when processing a subset of frames. - Report model loading, inference, tracking, motion estimation and total processing times separately where feasible. - Calculate effective processing FPS. - Report peak memory usage if practical. Do not sacrifice tracking quality merely to achieve a higher frame rate. ## 7. Validation and scientific assessment I want this implementation to be assessed critically, not merely demonstrated. Investigate potential failure cases, including: - Small and distant cattle. - Dense groups of overlapping animals. - Drone movement. - Stationary cattle appearing to move due to camera motion. - Moving cattle incorrectly classified as stationary. - Identity switches. - Animals temporarily disappearing. - False-positive detections. Perform practical sanity checks using the provided video. Where possible, produce short annotated samples illustrating successful and problematic tracking. Clearly separate: 1. Results directly measured from the video. 2. Estimates produced by the models. 3. Accuracy metrics that require manually labelled ground truth. Do not fabricate accuracy, precision, recall, tracking metrics or ground-truth counts. If there is no labelled ground truth, explicitly state which aspects cannot yet be objectively validated. ## 8. Deliverables Produce: 1. A functioning Python CLI that accepts `halter.mov` or another video. 2. An annotated MP4 output. 3. Structured JSON containing tracking and activity data. 4. A concise summary of the results. 5. A performance benchmark with actual measured execution times. 6. A brief description of the architecture, models and technical trade-offs. 7. Reproducible installation and execution instructions. 8. A short assessment of observed limitations and recommended improvements. Maintain the existing project's functionality and avoid breaking the earlier image-detection workflow. Use appropriate modular architecture and tests, but avoid excessive boilerplate, documentation or unnecessary frameworks. ## 9. Execution requirements Do not stop at designing a solution. Inspect the repository and the actual video, implement the pipeline, execute it against `halter.mov`, fix problems discovered during execution and generate the requested outputs. Start with a short representative section of the video to confirm that detection, tracking and motion classification work correctly. Then process the complete video using the selected configuration. If you encounter computational, dependency or model-compatibility limitations, explain them and pursue a practical alternative. Record the configurations used and any model or threshold changes made during development. **Do not ask me to make implementation decisions unless you encounter a genuine blocker that cannot reasonably be resolved independently.** ## 10. Final engineering report At the end, provide a concise table containing: | Metric | Result | |---|---| | Video duration | | | Total frames | | | Frames processed | | | Detection model | | | Tracking algorithm | | | Motion compensation method | | | Estimated unique cows | | | Peak simultaneous cow count | | | Moving/stationary classification summary | | | Total processing time | | | Effective processing FPS | | | Model loading time | | | Observed tracking failures | | | Known limitations | | Include the exact command needed to reproduce the output. The broader objective is to evaluate how effectively a modern AI coding agent can independently develop a sophisticated computer vision application from natural-language instructions. Prioritise **demonstrable functionality, measurable performance, correct engineering decisions and honest assessment** over extensive explanations or impressive-looking but unreliable results. 

RESULT HERE

It is not ideal. I’m fairly certain that from another extreme drone angle, the detection rate would be worse, but still—the speed with which the experiment moved from photo detection to an initial video-analysis system is what perplexed me. It doesn't mean that the hard problems have disappeared. It means we arrive at them much sooner.

So are we at 85% in an hour?

My subjective impression is that we reached something in the ballpark of 85% of a working prototype fairly quickly.

Not to be confused with 85% detection accuracy—it is not. And it's definitely not 85% of the engineering effort required to ship a production monitoring system.

It pretty much means that in well under 2 hours of experimenting, I could demonstrate a surprisingly broad set of capabilities that used to require a massive amount of research and development.

The remaining work is still the expensive part—all farms would be different, cows could be different, and edge cases could be completely different.

The last 10–15% of visible functionality can easily contain most of the work required for production-ready software.

What actually changed in 12 years?

In 2014, deep-learning object detection was already advancing quickly. R-CNN was a major milestone that year. So it would be historically wrong to say that reusable pretrained vision was nonexistent back then. What was much less accessible was today's combination of mature pretrained models, easy-to-install frameworks, and coding agents that could pretty much set all of it up without any hassle.

That's the difference I wanted to measure.

I didn't train a new cow detector. I didn't invent a new tracker. And Claude didn't magically solve the difficult edge cases. It selected and integrated state-of-the-art (from its perspective) tech, built test infrastructure around it, generated outputs, and iterated until everything was flawless to its liking.

The real acceleration was in turning existing capabilities into working software.

For me, that's where AI-assisted development is making its mark—not by eliminating the need for expertise, but by moving the developer much faster from a blank repository to the point where expertise becomes essential.

12 years ago, much of the effort was just getting the model running and then enhancing it from there. Today, we can have that state before lunch on the same day.

And once we reach that stage, the challenge of tackling the last 10–15% will still be waiting.

Code and reproducibility: github.com/xMKx/cattle-monitoring — the publicly available repository currently documents the image-detection stage and its validation in detail. Video-stage code/results should be linked here once published.

Video material: The drone video experiment used cattle footage associated with Halter. This is an independent engineering experiment, not a Halter product evaluation or endorsement. [https://www.youtube.com/watch?v=l7Q1hMWSW8w]

Background references: R-CNN, Girshick et al., CVPR 2014 · Ultralytics: measuring end-to-end latency

I'm a software engineer who has spent years building computer vision systems, and I work on software and R&D through Kratt Ventures. This experiment is my attempt to measure what AI coding agents genuinely change—and what they don't.