r/computervision • • 7h ago

Showcase I optimized camouflage patterns with gradient descent (interactive demo)

109 Upvotes

Article: https://virostatiq.com/camouflage-gradient-descent/

Demo: https://virostatiq.com/projects/camouflage/

I grew camouflage patterns for a 3D human figure using gradient descent through a differentiable renderer. I tested them against two observers: a model of human vision, and person detectors. There's a write-up and an interactive three.js demo (links below).

Setup

- Figure: a MakeHuman figure (built with MPFB in headless Blender) in four poses: standing, walking, crouching, kneeling. Only the colours of the shirt and trousers are optimised.

- Scene: one 360° HDRI (Poly Haven, CC0) is both the backdrop and the light source. Lighting uses 9-coefficient spherical-harmonic irradiance, so the cloth is shaded as it would be on that site.

- Rendering: PyTorch3D. The geometry is fixed, so each view is rasterised once and only re-shaded at every step. A run takes about a minute on an RTX 3090 (256 px renders, 512 px texture, 400 steps).

- Held-out test: the panorama is split into six 60° sectors. The optimiser trains on three, and every reported number comes from the other three.

- Background panning: during training the background shifts randomly by up to ±12°, so the pattern can't memorise the strip of panorama that is always behind the chest.

Observer 1: a hand-built visibility loss, computed at several image scales (an image pyramid), comparing the figure with the background right behind it:

- contrast across the silhouette, relative to the background's own edges

- contour coherence

- colour difference

- texture difference, from VGG Gram matrices

Pattern constraints

- A learnable palette of 5 colours, picked from the training views.

- Either crisp patches of 5–10 cm or 1.5 cm "digital" pixels.

- A density penalty that keeps any one colour from forming patches larger than about 11 cm.

- The constrained patterns score within a few per cent of a free texture.

Observer 2: a person detector. COCO-trained Faster R-CNN is added to the loss, using its person confidence on views at 8–30 m. RetinaNet and FCOS are used only for testing transfer.

Results (held-out views; detection rates are the mean over the three detectors)

- At 30 m, the person is detected in 99% of views in the original clothes, 74% in an optimised flat colour, 48% in the patch pattern, and 21% in the pattern trained with the detector.

- Averaged over all distances, adding the detector to the loss lowers detection from 75% to 53%. The two detectors that weren't in the loss are fooled even more: at 30 m, RetinaNet finds him in 8% of views and FCOS in 14%.

- The two observers produce the two strategies biologists describe. The vision model leads to background matching. The detector leads to disruptive colouration: more contrast, plus colours the forest doesn't have (rust, tan, pale mint). The disruptive pattern is easier to spot up close.

- In rubble, every pattern does no better than one well-chosen flat colour. In deserts, the patterns don't carry over between sites: on a desert site never used in training, every trained pattern lost to the original clothes.

- "Adaptive cloth", which re-tunes its 5 colours for each viewer, cuts the far-distance outline score from 0.41 to 0.12 in the forest. It doesn't help up close in direct sun.

Demo: three.js with the optimiser's shading ported to a shader (same SH lighting and tonemapping). The pattern's evolution is recomputed on the GPU from saved snapshots and matches PyTorch to within 0.06/255 mean error. There's also a "Find him" mode.

Limitations: it's a simulation with diffuse light only (no shadows), and there's no human study yet. I compare against related work in the write-up: Owens et al. 2014, GANmouflage, the Bristol camouflage group, and adversarial clothing (AdvCaT and others).


r/computervision • • 22h ago

Showcase Ai2 released Molmo3 - an open, 3D VLM

45 Upvotes

Ai2 just released Molmo3; an open, 3D VLM, which can point, segment, and estimate depth to return 3D boxes from image/video 🤯

I paired the 4B model with Meta's VGGT-Ω to go from a 32s phone video to a labeled 3D room, locally:
• VGGT-Ω gives depth and camera poses for 54 key-frames (2.4 min on M4 Max)
• Molmo3 segments 12 object types in each frame
• The masks are lifted to 3D and merged across frames
• Result: 16 objects in 3D, with no training and no labels


r/computervision • • 3h ago

Help: Project I rebuilt the YOLO11 training pipeline from scratch. It's open source if you want to use it or learn from it

7 Upvotes

Since last year I worked on building the YOLO11 training architecture from scratch and it is at a point where I am happy to share it. The repo is here: https://github.com/hlreicha/glassbox-yolo

The main reason I built it was I wanted to understand and control every part of the training pipeline that is more human readable and not relying on a big framework with an AGPL license. The hope of rewriting everything from scratch and train my own weights would sidestep that license. Right now only Object Detection is currently supported.

This is what I implemented so far:

  • YOLO11 model in n/s/m/l/x sizes, defined by a YAML config.
  • Full training loop with SGD/AdamW, warmup, EMA, checkpointing and resume.
  • Task aligned assignment (TAL) and the box/cls/DFL loss.
  • Augmentation pipeline with mosaic, HSV, flips, translate, scale, rotation and perspective.
  • Validation with mAP@50 and mAP@50-95, plus NMS and postprocessing.
  • CLI commands for training, validation and prediction.
  • Pretrained weights can be loaded as a starting point.

Install is just pip install -e . after you get PyTorch set up for your platform.

AI Use Disclosure:
I used an AI assistance on to help scaffold the project structure, the training loop boilerplate, and debugging. In addition it was extremely useful to learn how the loss, TAL, and post-processing work in this architecture.

Results:

I trained YOLO11n and YOLO11s on COCO for 550 epochs. I'm about 1-2% mAP behind the Ultralytics reference numbers. It started out much worse and most of the improvement came from fixing augmentation details, loss normalization and EMA. The goal was never to beat Ultralytics, it was to own and understand the whole pipeline. I am also limited on compute since I am only using RTX 3090 to train the models.

If you want to use it, learn from it, or tear it apart, the repo is open. Happy to answer questions about anything in there.

Any feedback or insights are very welcomed. I would like to have collaborators with this project as well.


r/computervision • • 6h ago

Discussion Bounding box format gotchas I hit while writing exporters for YOLO, COCO and Pascal VOC

1 Upvotes

I've been writing dataset exporters for an annotation tool, and most of the bugs I hit were not in the code but in small differences between formats. Here's the list in case it saves someone a broken training run:

  1. Box encoding is different in every format

- YOLO: class cx cy w h, center point and size, normalized to 0–1 by image width and height

- COCO: [x, y, w, h], top-left corner and size, in absolute pixels

- Pascal VOC: xmin ymin xmax ymax, two corners, absolute pixels

Converting YOLO to COCO without moving from center to corner gives boxes shifted by half their size. They look almost right on big objects, which is why it's easy to miss.

2. You need the image size to convert YOLO

YOLO labels are normalized, so you can't get pixels back without reading each image's width and height. If your images were resized after labeling, the normalized labels still fit, but pixel formats do not.

3. Class IDs start at different places

YOLO class IDs are 0-based indexes into your class list. COCO category IDs are whatever the categories array says, and many datasets start at 1. An off-by-one here trains a model where every class is the wrong one.

4. VOC uses class names, not IDs

VOC XML stores the class name as text. Rename a class in one place and not the other, and those objects silently disappear from training.

5. Empty images

YOLO expects an empty .txt for images with no objects (background images); some pipelines skip the image if the file is missing. COCO keeps the image in images with no annotations.

6. Polygons

YOLO segmentation is class x1 y1 x2 y2 ... normalized; COCO stores polygons in absolute pixels and also needs area and bbox filled in, or some evaluation code breaks.

My habit now: after any conversion, draw a few random images with their converted boxes before training. It takes a minute and catches all of the above.

Disclosure: the tool is SwiftLabel, a paid desktop app I make (offline, local YOLO/SAM pre-labeling, 14-day trial): https://swiftlabel.io/?utm_source=reddit&utm_medium=community&utm_campaign=swiftlabel_trial_202612&utm_content=computervision

What other format traps have you run into?


r/computervision • • 5h ago

Showcase Open source on-device Pokémon card scanner & dataset

0 Upvotes

We’ve built an open-source card scanner that names the exact printing of a Pokémon card from a photo, and can pick the exact print from an index of over 200,000 cards — the most complete dataset of cards available, covering every language.

It’s a set of fine-tuned models & harness, small enough to run entirely on an iPhone, detecting dozens of cards from a photo in a couple seconds (with first feedback within 300ms)

The code, models and the dataset it's built on are at cardcorpus.com — code on GitHub, models on HuggingFace.

How it works

A small card detector we trained ourselves, on a MobileNetV4-small backbone, finds every card in the photo, even rotated, overlapping or in a pile.

Each card is straightened and turned into a fingerprint by a fine-tuned DINOv3 ViT-S/16. That fingerprint is matched against about 100k reference images of cards in English, Japanese and Chinese.

Reprints often share the same art, so to tell them apart we read the collector number and set code (OCR) and line the card up against our scans using classic computer vision (SIFT) to compare the small details.

First results appear in about 0.3s, and the full double-check finishes a second or so later. As the models improves, the double-check is finding even fewer places to correct.

We trained the models on cloud GPUs using thousands of real card photos. We labelled those photos by hand at first with custom tooling, and once the models got good enough we only had to double-check their answers.

OPEN SOURCE

Initially it was for our iOS app, pennysleeve.app, but we want everyone to benefit from the datasets & models!

cardcorpus.com


r/computervision • • 10h ago

Research Publication Why Large-Scale Video Analytics Belongs on the Server, Not the Camera

0 Upvotes

Video analytics has quietly become one of the most demanding workloads in modern infrastructure. What began as simple motion detection now spans people counting, traffic analysis, demographic estimation, biometric identification, and ” increasingly” open-ended understanding of a scene through video language models. As the ambition of these deployments grows, so does a foundational architectural question: should the intelligence live on the camera, or on the server?

 

Both approaches are viable, and each has a legitimate place. But the two are not interchangeable, and choosing the wrong one for the scale of a project is an expensive mistake. For simple deployments with a handful of cameras, on-camera analytics can be perfectly adequate. For large, evolving, mission-critical projects, server-based analytics wins on performance, flexibility, and “perhaps counterintuitively” total cost of ownership.

 

**The appeal of the camera and where it breaks down**

 

The case for camera-based (edge) analytics usually starts with capital expenditure. If each camera carries its own accelerator and runs its own inference, you avoid buying a rack of servers and GPUs. The intelligence is distributed, the network carries less raw video, and on paper the hardware bill looks lean.

 

That logic holds until you try to scale. On a ten-camera pilot, distributing compute across the devices is manageable. On a project with hundreds or thousands of cameras spread across a city, the picture inverts. Every camera becomes an independent compute node that must be provisioned, updated, monitored, and eventually replaced. Analytics capability is now welded to hardware that was chosen years ago and is sitting on a pole in the field. When the requirements change and in video analytics, they always change you are looking at a hardware refresh across the entire fleet rather than a software update in a data center. The capex saving that justified the edge approach erodes as the deployment grows, precisely when budgets are most sensitive to it.

 

**Camera accelerators cannot match server-grade compute**

 

The hard ceiling on edge analytics is silicon. The accelerators embedded in smart cameras NPUs, VPUs, and similar edge chips are engineered around tight power and thermal budgets. They typically deliver compute in the single to low tens of INT8 TOPS. That is genuinely impressive for a device drawing a few watts, and it is enough to run a detector or two.

 

It is not in the same universe as a data-center GPU. A modern server-class GPU can deliver on the order of a thousand INT8 TOPS or more, and a single server can hold several of them. Just as important, a server can batch and schedule work across many camera streams at once, keeping expensive silicon fully utilized rather than leaving it idle between frames on a single view. No camera accelerator can match or beat this not on raw throughput, not on the size of models it can run, and not on efficiency of utilization across a fleet. The edge chip is optimized to be small, cool, and cheap; the server GPU is optimized to be powerful. When the workload is heavy, power wins.

 

**One camera, many use cases**

 

This compute headroom translates directly into capability. Because a server is not constrained to whatever the camera's chip can handle, a single video stream can drive many analytics pipelines simultaneously. From one camera feed, a server-based system can run multiple directional pathway counts, estimate age and gender, perform biometric identification, detect objects and anomalies, and track dwell time — all at once, and all upgradeable independently.

 

On the camera, every additional use case competes for the same tiny compute budget, and adding a new one often means reaching the limits of the hardware. On the server, adding a use case is a software decision. The same infrastructure that runs three models today can run six tomorrow without anyone visiting a single pole. This is the difference between a deployment that is frozen at install time and one that keeps getting more valuable as analytics improve.

 

**The video language model wave changes the math**

 

If there were any remaining ambiguity, the arrival of video language models settles it. These models bring a new class of use case: natural-language search over video, open-vocabulary detection, contextual scene understanding, and reasoning about events rather than just detecting objects. They are also enormous. Running them requires substantial GPU memory and compute that simply does not exist on a camera and will not for the foreseeable future.

 

Organizations that want to take advantage of this new generation of analytics have no realistic path to doing so at the edge. The models are best served, “often only served” from server infrastructure built to host them. A deployment architected around camera-based analytics is, by construction, cut off from the most important developments in the field. A server-based deployment can adopt them as they mature, on the same infrastructure it already runs.

 

**Heat is the enemy of the edge especially in the Middle East and the gulf.**

 

There is a physical dimension to this that is easy to overlook from an air-conditioned office. Cameras with built-in accelerators run hot, because inference is power-hungry and that power turns into heat inside a sealed enclosure. Now place that enclosure on a street in the Gulf, where ambient temperatures routinely climb past 45-50°C in summer and the housing bakes in direct sun.

 

The accelerator's own heat stacks on top of an already punishing environment. The result is elevated junction temperatures, thermal throttling that quietly degrades performance when you need it most, and accelerated aging of components that shortens the camera's service life. Field replacements in harsh outdoor conditions are costly and disruptive, and a fleet that ages faster than planned undermines the entire business case. Server GPUs, by contrast, live in climate-controlled data centers designed for exactly this thermal load, where cooling is engineered rather than left to chance on a pole.

 

**The economics favor the server at scale**

 

Put all of this into a total-cost-of-ownership model over the life of a large deployment, and the server-based approach comes out cheaper not despite the centralized GPUs, but because of them. Good scheduling algorithms keep those GPUs highly utilized by sharing them across many streams, so you buy compute for the aggregate workload rather than over-provisioning every camera individually. Auto-scaling lets the system expand and contract with demand instead of paying for peak capacity everywhere, all the time.

 

Maintenance is centralized: upgrades, security patches, and new models roll out from the data center rather than through thousands of field visits. Cameras become simpler, cheaper, longer-lived devices whose job is to capture good video, while the expensive and fast-moving intelligence lives somewhere it can be maintained and refreshed economically. Over a multi-year horizon (which is the only horizon that matters for infrastructure) that combination of high utilization, elastic scaling, and centralized maintenance consistently beats the distributed alternative on lifetime cost.

 

**Conclusion: match the architecture to the ambition**

 

None of this makes camera-based analytics wrong. For simple projects with a limited number of cameras and a fixed, modest set of use cases, running analytics on the edge is reasonable. The point is not that one architecture is universally superior; it is that they solve different problems.

 

Large-scale projects are a different animal. They demand throughput that edge silicon cannot provide, the flexibility to run many use cases per camera and to add more over time, a path to adopt compute-hungry video language models, resilience against harsh operating environments, and an economic model that holds up over years of operation. On every one of these dimensions, server-based video analytics is the architecture built for the job. When the deployment is big, evolving, and expected to last, the intelligence belongs on the server.