Contents
One form sits on the desk. It gets three questions: where the field is, what is written in the cell, and whether that cell is empty, a ditto mark, or a value. The model is already answering on the line. The report shows a high share of correct frames, and bad parts still move on. In that meeting the team argues about a class name in code: nn.Module or tf.keras.Model.
On one form, that is what the vision job looks like. PyTorch and TensorFlow do the same work on a frame. Data becomes a tensor, the tensor goes through a model, the loss shifts the weights, inference returns an answer. The API style changes. The chain stays. For the calls themselves, see PyTorch vs TensorFlow; for the wider family, see ML frameworks.
Key takeaways
Write down which question you are asking the form on the desk. A class for the whole sheet, a box around a field, a mask of a defect, a line of text, and a scene changing over time share one foundation: the data, the way the picture is represented, the training setup, and the metrics. The library runs that setup.
The dataset decides earlier than the architecture. The same form in both the training pile and the check pile, a rare defect drowned by “all good,” and shop-floor pictures that do not match the ones you measured will break a ResNet and a newer net alike. For the model, a picture is a tensor: shape, channels, normalization, batch. Weights that already saw ImageNet are the usual industrial start when the shop does not look like another world.
Pick the library for the team and the infrastructure. Once the vision chain is clear, moving between PyTorch and TensorFlow is a change of tool.
A class name does not read the form
The form is on the desk, and the meeting is about a class name in code. The question to the frame is a different one: what is in it, where the object sits, which pixels belong to it, what is written, how the scene moves through time. A library runs that math on a device. nn.Module and tf.keras.Model are not part of the question.
The expensive mix-up fits in that same meeting. People argue about class names while the same sheet sits in training and in the check set. Accuracy looks clean and falls apart on the shop floor.
This is for developers who are entering vision, or who already write in one library and want an understanding that survives an API change. It is also for leads who have to separate library choice from system quality, and for engineers who sit next to form reading, diagram detection, or quality control — as in the UT form pilot and YOLO on diagrams.
The chain below is the same in a mature stack. Read it as the order of decisions on that form: which step you are on, and which step usually gets skipped.
problem → data → labels → preprocess → model → train
→ evaluate → export → infer → feedback into data
The arrow back into the data closes the chain. Stop at a weight file, and the next shift is invisible to the model. The next form on the desk is not in the world it stopped on.
Three questions on one sheet
A form comes off the scanner onto the desk, the kind of sheet in the UT pilot. The shop does not need a verdict on “what this photograph is.” It needs a region: where the field sits on the page. A detector draws a box around the cell. That box is the answer to “where.”
Inside the box, a separate step reads the writing. Another step decides whether the cell is empty, carries a ditto mark, or holds a value. Three questions on one sheet, three outputs. The table matches a question to an output. The lesson is the order you just walked on the form; a row is there when you need the name of the output.
| Task | Question | Typical output |
|---|---|---|
| Classification | What is it? | Class / class distribution |
| Object detection | Where is the object? | Class, box, and confidence |
| Semantic segmentation | Which pixels belong to the class? | A mask per class |
| Instance segmentation | Which pixels belong to this object? | A mask per object |
| OCR | What is written? | A string or a field structure |
| Image enhancement | How do you clean the signal? | A cleaned or restored image |
| Image retrieval | What looks like this frame? | A list ranked by similarity |
| Video analysis | What happens over time? | Events, tracks, and actions |
The tree below is the same set of questions, drawn as forks. See which question your next step actually stops on.
Image
│
├── What is it? ──────── Classification
├── Where is it? ─────── Detection
├── Which pixels? ────── Segmentation
├── What is written? ─── OCR
└── What is happening? ─ Video analysis
If the next step crops a region, stop at a box. If you need the shape of a defect, continue to a mask. One industrial path stitches the steps: find the field, read the writing, decide empty / ditto / value. That is how the UT form is built, and how diagram work is built in YOLO engineering.
The same sheet in both piles spoils the report
On a form pilot, accuracy gets flattering for a dull reason: nearly the same sheet landed in training and in the check set. That is not yet the rule “empty / ditto / value.” A cut by file name lets one part, one shift, or one camera leak into both sides. The net recognizes the form. It does not learn the rule you wanted.
A dataset is a contract: where the frames came from, which labeling rules apply, how the cut was made, which classes are rare, which holes you already know. A rare defect drowns in “all good.” Two annotators draw different boxes on one object, and the net learns their disagreement. A night shift, a new scanner, or a new form moves the pictures off the conditions you measured.
The same holes, for scanning:
- near-duplicate frames in training and in the check set;
- a cut by file instead of by object, sheet, shift, or camera;
- a rare defect drowned by “all good”;
- two annotators’ boxes on one object that do not agree;
- night, another scanner, another form — the check set is no longer this shop.
A larger model does not sew those holes shut. Swapping a ResNet-50 base for a ResNet-101 memorizes labeling artifacts faster. How to build the contract: the dataset series. How to talk about the cost of a mistake: quality metrics.
The network receives numbers from the form
The eye sees the form on the desk. The network sees an array of numbers: height, width, channels, and, in training, a batch axis. One pixel is a number, or three numbers when the color is red, green, and blue. The cell you found by eye is already a slice of that array.
What matters next is the agreement about how that array sits in memory. PyTorch often uses N×C×H×W. Keras and TensorFlow often use N×H×W×C. The picture is the same. The library’s habit differs. The chain below is that passage, left to right, from frame to answer.
Image → Pixels → Tensor → Model → Prediction
If normalization differs, training and inference diverge quietly: the experiment scaled pixels one way, the service another, and the log shows no error. Fix the numeric type beside it (float32 and its neighbors) and the device, CPU or GPU. Batches of tensors and convolutions live on accelerators; the device map is in AI hardware.
Seeing starts at the edge of a stroke
On a form and on a weld image, the eye catches the edge of a stroke, the grain of a defect, the corner of a cell. Early kernels in a convolutional net answer to those edges; later maps answer to parts, later still to the object. The net stacks those responses.
A small kernel slides over the feature map. The window’s step and the padding at the borders set the geometry, pooling shrinks the grid, and an activation bends the response so a stack of layers does not collapse into one linear blur. A feature map is the filter’s answer to a local pattern. The chain below is that stack, from the bottom up.
Pixels → Edges → Textures → Shapes → Objects
Locality and shared weights fit pictures, which is why convolutions stay on the shop floor. Vision transformers and hybrids earn a place when the dependency is long and the corpus is large. For many industrial jobs the working standard is still convolutions, U-Net, and detectors built on a convolutional base. From convolution to models that read a sequence of symbols: handwritten digits.
One answer for the whole sheet comes first
The sheet on the desk gets one answer for the whole frame: acceptable, or not. That is classification: one decision for the entire image, with no coordinates. A photo of a cat works the same way: “cat.”
The network emits raw scores, the logits. Softmax turns them into shares of a single class; a sigmoid is for several labels at once. The loss is often cross-entropy. Accuracy is easy to put on a slide and dangerous when almost every frame is good: a model that always says “good” scores high and misses rare scrap. The sketch below is that single decision.
Cat image → CNN → cat: 0.93 · dog: 0.05 · fox: 0.02
Then read the confusion matrix, precision, recall, and their mean (F1), and separately the cost of a false alarm and of a miss. The confidence threshold is part of the product: you move it once the cost of a mistake is clear. More in quality metrics.
When are borrowed weights enough for the form?
You do not have to buy the edge of a stroke and the corner of a cell with your own scans from a blank page. A network that has already seen a large general corpus (ImageNet, or an industry set) already responds to edges and textures you would otherwise pay for with your own frames. The usual industrial start is transfer learning: take those weights and adapt them to your task.
Two working modes. Freeze the early layers and train only the last one: the old filters stay, the new decision learns your classes. Or unfreeze part of the net and take a smaller step, so you do not wipe the filters you already have. ResNet, EfficientNet, and the YOLO families are a start. The task still lives in your data. The chain below is that handoff of weights.
Pretrained Model → Freeze / Fine-tune → Your Dataset → Your Model
Training from scratch has a reason when the domain is radically different, the license forbids those weights, or the goal is research. In applied work, adaptation usually wins. Detection follows the same rule: your model starts from ready weights (YOLO).
A box crops the cell; a mask measures the defect
A class on the whole frame says “there is a car in the image.” On the form, the next question is about place: where the field sits. Object detection answers with a class, a box [x, y, w, h], and a confidence. Overlap with the label is measured by IoU; near-duplicate boxes on one object are collapsed with NMS. The usual families here are YOLO and R-CNN.
A box is sometimes too little. Segmentation asks which pixels belong to the object. Semantic segmentation paints a class on each pixel; instance segmentation gives a separate mask per object. The usual anchors are U-Net and Mask R-CNN. The two lines below are the contract: a region, or a mask.
Box → object region
Mask → exact object shape
If the next step crops a cell and reads a digit, a box — or even the form’s own geometry — is often enough. If you need the damaged area on a scan, you need the mask. Detection engineering: YOLO. The vision map on a weld radiograph: weld AI architecture.
Train only on what the line will actually see
A pale form from the night shift, if that shift exists on the line, should show up in training as something like it. You expand the sample on purpose (augmentation): rotation, crop, mirror, scale, brightness, noise. That helps when the same distortion exists in the shop. The night form is a condition of the shift, not a picture added for variety.
The same move breaks the task when it invents a world the line will never see. A mirrored symbol on a diagram is a different symbol. An upside-down digit declared a “new” class teaches a class that does not exist. Distortions that never appear in the shop teach robustness to a fiction. The loop below is the same in both libraries. Watch the loss move the weights.
Image → Model → Prediction → Loss → Backpropagation → Optimizer → Updated Weights → Repeat
An epoch, a batch, and the step size read the same way in either API. Training accuracy rising while check-set accuracy falls means the net is memorizing holes. Another epoch on the same holes does not open them. Evaluate the training part, the check part, and a held-out test part, then frames from the floor. The confusion matrix, false alarms, and misses are how you talk about cost. The sketch below is that split in the curves.
Training accuracy ↑
Validation accuracy ↓
↓
Overfitting
What reaches the shop is weights, preprocessing, and a threshold
Tomorrow another form lands on the desk. What meets it is not the weight file alone. It is the pixel scaling and the decision threshold that traveled with those weights. Training ends when the weights are saved. The shop starts at inference: delay, model size, which preprocessing was frozen with the weights, whether the frames have drifted from the ones you measured, and how you roll back.
A weight file without the code that scales the pixels, and without the decision threshold, is not the system whose accuracy you wrote in the report. Three versions ship as one package: weights, preprocessing, thresholds. Swap only the weights and leave normalization from an old experiment, and the report no longer describes the service. The chain below is the handoff from training to the application.
Training → Model → Export → Inference → Application
A server, Docker, a phone, a device by the camera, a browser, quantization, and distillation are different limits on one mathematical object. Teams often train in PyTorch and serve through ONNX Runtime or in the browser with WebGPU + Transformers.js. The training library and the inference runtime are different layers.
On the shop floor, watch the share of refusals by confidence, the 95th percentile of response time, and new kinds of error in frame review. Otherwise the people who receive the output notice the drift first.
Both libraries read the same form
You can ask one form the same questions in either library: where the field is, what is written, empty or value. The thinking does not change: a batch, a forward pass, a loss, a step back, an update of the weights. What changes is the name you type and the surroundings of the library. Someone who can explain the step in plain words can find the same step in the other library.
The table is a rename chart, not a ranking. Read across a row when you are porting a loop. The choice under the table is about the team.
| Concept | PyTorch | TensorFlow |
|---|---|---|
| Tensor | torch.Tensor |
tf.Tensor |
| Model | nn.Module |
tf.keras.Model |
| Layers | torch.nn |
tf.keras.layers |
| Dataset | Dataset / DataLoader |
tf.data.Dataset |
| Training | an explicit loop | fit() or your own loop |
| Vision surroundings | TorchVision, Ultralytics, timm |
KerasCV, TensorFlow stacks, TF Hub |
| Shipping the model | export | SavedModel, Serving, Lite |
A neutral comparison, with no winner: PyTorch vs TensorFlow. Research groups and much of applied vision more often take PyTorch. An existing Keras stack, or a plan to train on TPU, is a serious reason to stay on TensorFlow. The question is which tool fits this team and this infrastructure.
Take one form through to the shop before a second library
Two APIs at once, and no form carried through to a service, is how a year disappears. One frame, one question, one library, carried through to a service, teaches the chain. The second library then reads as a translation. A question to the sheet, carried through to the shop, is that chain.
The order below is that path. Metrics and an honest cut come before a fashionable architecture. Ready weights come before training from scratch. Detection comes after you already know what “wrong” costs on a simple class label. Depth in PyTorch or TensorFlow is the last layer, once the chain is familiar.
- Python and
NumPy - Images and
OpenCV - Tensors and neural nets
- Convolutions and the training loop
- Metrics and an honest cut
- Transfer learning and classification
- Detection and segmentation
- Inference and watching it in service
- Depth in
PyTorchorTensorFlowfor your stack
The same chain shows up in document and form reading, quality control, medical and industrial images, sorting cameras, diagrams, and video. On a production line, one model for everything rarely wins. Short links win: an explicit contract between them, and a shared way to push errors back into the set.
The diagram below is that chain with the arrow drawn back into the data. Check whether the loop actually closes.
REAL PROBLEM → DATA → ANNOTATION → PREPROCESS → AUGMENT
→ MODEL → TRAIN → EVAL → INFERENCE → DEPLOY → FEEDBACK → DATA
The usual early stop is at training, before inference, and before the next shift’s bad frames return as data. Beside that, the usual start-up mistakes: learning two APIs without finishing one task; chasing the newest architecture from papers on crooked labels; measuring only the share of correct answers; forgetting that preprocessing is part of the model. One end-to-end mini-project is cheaper: a class for the frame, metrics, export, a simple service. A stack of tutorials that never reach inference costs more.
Books such as PyTorch Computer Vision Cookbook and Hands-On Computer Vision with TensorFlow 2 help with the shape of the steps. Check live syntax against the docs — APIs move. Keep the official guides for PyTorch, TorchVision, TensorFlow, Keras, and OpenCV nearby.
FAQ
Where should I start Computer Vision in 2026?
With a question to one form and a small honest set. Then classification on ready weights, in the library the team already has — often PyTorch. Picking a logo “for your career” is early: the chain has not been tested on your task yet.
Do I need both PyTorch and TensorFlow?
For shop-floor work, one library plus the ability to read the other is enough. The math and the chain transfer. Rewriting the loop is days, not months, once the forward pass, the loss, and the data cut are already in place.
Why is accuracy high on the check set and poor on the shop floor?
The shop frames are distributed differently, the same part landed in both sides of the cut, preprocessing in the service does not match the experiment, or the cost of a mistake is different. Take frames from the floor and the confusion matrix on the classes that actually cost money.
When is OpenCV enough without a neural net?
When the rule is stable: a threshold, morphology, projections, a template. A network is for pictures that vary a lot, once hand-tuned rules are already expensive. Form geometry plus a model often holds up better than a network on the whole frame at once.
A box or a mask?
A box, if the next step is a crop, a count, or reading text in a region. A mask, if you need exact shape, area, or separating the background pixel by pixel.
How does vision connect to LLMs and RAG?
Stabilize vision first: objects, fields, text, structure. Put the language model on facts you have already extracted. It does not replace coordinates. A diagram example: YOLO.
Are Computer Vision books still useful?
Yes for the tensor, convolution, sample expansion, metrics, and transfer learning. Check concrete calls and weight versions against the docs and against the weights you actually load.
Further reading
Conclusion
The vision chain starts with a question to the form on the desk and ends when an error from the line comes back into the set. PyTorch and TensorFlow run that chain under different call names and in different surroundings.
Data, an honest evaluation, the kind of answer you need (class, box, mask, or text), and the inference package outweigh an argument about which library won a comparison test. The next step is one end-to-end mini-project in the library the team already has: a class for the frame, metrics tied to the cost of a mistake, export, and a simple service.
Three questions on one sheet, carried through to a service, and the second library reads as a translation.



Comments