The checks a script can do before a human looks
Blur, duplicates, wrong aspect, wrong model build: the checks that clear part of a batch on Seedream 5.5 before anyone spends review time on it.
Review is the bottleneck, which means every minute of it that goes to a mechanical failure is a minute of the most expensive resource in the pipeline spent on the least interesting question.
An image that is 1,600 pixels wide when the destination needs 2,000 does not need a human to look at it. Neither does a file that is byte-identical to the one two rows up. Those are yes/no facts about a file, and facts belong in a script.
The distinction worth holding onto: a script is good at rejecting and bad at approving. Everything below is designed around that asymmetry.
The six checks worth writing
| Check | Catches | Misses | Typical false positives |
|---|---|---|---|
| Dimensions and aspect ratio | Wrong size, wrong crop, provider silently returning a default | Nothing; it is exact | None, if the spec is right |
| Colour profile | sRGB vs Adobe RGB mismatches that shift on the web | Nothing detectable | None |
| Filename pattern | Broken joins between table row and file | Swapped names (still valid) | None |
| Near-duplicate (perceptual hash) | Two rows resolving to the same image | Same subject at a different angle | Symmetrical products |
| Blur (variance of Laplacian) | Failed focus, over-smoothed output | Blur that looks intentional | Deliberate depth of field, heavy gradients |
| Edge and background sanity | Cutouts with haloes, subject touching the frame edge | Subtle transparency errors | Products that legitimately fill the frame |
Six checks, all cheap, all local. None of them requires a model call, which matters because a QA step that costs money per image is a QA step that gets turned off when the budget is tight.
The two worth writing carefully are the hash and the blur, because both are thresholds rather than specs.
// perceptual hash: 8x8 greyscale, compare bits, Hamming distance
function dhash(pixels, w, h) {
const small = resizeGrey(pixels, w, h, 9, 8);
let bits = 0n;
for (let y = 0; y < 8; y++)
for (let x = 0; x < 8; x++)
bits = (bits << 1n) | (small[y * 9 + x] > small[y * 9 + x + 1] ? 1n : 0n);
return bits;
}
// a distance of 0–4 out of 64 is usually the same image
Thresholds are local, and that is the point
Every published threshold for blur, duplicate distance or edge contact was calibrated on somebody else’s images. Yours have a different subject density, a different background, and a different resolution.
So calibrate on fifty known-good files, once:
- Run the metric on the fifty.
- Take a low percentile — for blur, the fifth percentile of your approved set is a reasonable floor.
- Put that number in config with the date and the sample size beside it.
- Re-calibrate when resolution or subject mix changes.
A blur threshold is not a truth about image quality. It is a statement about what your approved images look like, and the moment that statement goes stale it starts rejecting good work — which is a worse failure than missing a soft image, because a rejection costs a re-generation and a small argument.
Auto-reject, never auto-approve
The dangerous automation is the one that says yes.
A false rejection enters a retry queue and costs one generation. A false approval enters the delivered set and costs whatever the customer does when they see it — a return, a complaint, a reprint, or worse, nothing at all for six months and then a very bad meeting.
So the script’s output is a rejection list, and everything not on it is still unreviewed. That is the whole design. Files that pass the mechanical gate are not approved; they are merely not disqualified.
| Outcome | Where it goes | Cost of being wrong |
|---|---|---|
| Fails a mechanical check | Re-run queue, with a reason code | One generation |
| Passes all checks | Human review | None — a human still looks |
| Auto-approved | Delivered set | Unbounded |
That table is the argument for the whole article, and it is worth pinning to the wall because every “AI QA” product pitch in this space eventually tries to sell you the third row.
One line per failure, machine-readable
The output format matters more than it sounds. A human-readable report gets read once. A machine-readable one gets consumed by the re-run step, which is the only way the loop closes.
SK-014,rerun,ASPECT,2048x2048 expected 2048x1365
SK-031,rerun,DUPLICATE,matches SK-030 distance=2
SK-058,rerun,BLUR,laplacian=42 floor=85
SK-072,review,OK
Reason codes also make the aggregate useful: a batch where 18 files fail BLUR is telling you something about a prompt or a model, while 18 files failing ASPECT is telling you something about your request parameters. Same number, different bug, and you only see the difference if the reasons are counted separately.
Our own experience: the first month of counting reason codes changed what we fixed. The defect we had been treating as “models being inconsistent” turned out to be one template request with the wrong height value, which was a two-minute fix that had been costing a percentage point of every batch for weeks.
Where the script sits in the pipeline
Immediately after generation, before the approval gate, and before anything that costs money per image.
generate → mechanical checks → human review → upscale → matte → derive sizes → deliver
Two consequences follow from that ordering, both of them financial:
Nothing expensive runs on a file that will be rejected. The cost arithmetic is unforgiving here: an upscale applied before approval is charged to every image that later fails.
The human sees a smaller, cleaner set. In a typical run 10 to 25 percent of files fail something mechanical. Removing them first does not just save the glance at each one — it changes the pace of the review that follows, because a reviewer who has hit four obviously broken files in a row starts skimming the good ones.
What must not be automated
Anything where the answer is a judgement: whether the product is the right product, whether the image is on-brand, whether a face is acceptable, whether a garment is the correct garment.
Those need a human, and they need the human fresh — which is the actual argument for this script. Every mechanical failure you remove is attention returned to the part of review that cannot be delegated, and review capacity is the thing that sets your delivery date.
There is one mechanical check missing from the six, and it is not about the file at all: whether the run used the model it was approved on. A batch approved on Seedream 5.5 and regenerated on Seedream 5.0 Pro has nothing wrong with any individual file — right dimensions, right profile, right names — and the set is still not the set anyone signed off. The request id is in the run record, so the check is a string comparison against the id the batch was approved with, and it catches the mistake that no amount of looking at thumbnails will surface.
If you only do one thing
Write the spec checks first, and make them blocking.
Dimensions, aspect, filename cost an afternoon to build and catch the failures that make a batch look careless. The perceptual ones are better engineering and lower priority, because a batch with the wrong crop is a batch nobody trusts, and trust is what allows the next batch to run at all.
Tests run by the Seedwan lab · Reviewed and edited by Michael · How we report