r/computervision 23h ago

Help: Project Camera recommendation for real-time object tracking on a conveyor belt (Budget: ~$150 - $280)

Enable HLS to view with audio, or disable this notification

Upvotes

​Hi everyone,

As shown in the attached video, I am working on a real-time computer vision system deployed over an industrial conveyor belt to detect, track, and count potatoes moving continuously along the line.

​My current camera(Fantech webcam 2k 30fps) setup is a bottleneck due to motion blur and frame pacing. I am looking to upgrade within a budget of roughly $150 – $280

​Based on the belt speed and object motion seen in the video, I'd like your advice on frame rate requirements:

​Is 30 FPS sufficient, provided I can manually lock a fast shutter speed (or use a Global Shutter) to freeze the motion, or does accurate multi-object tracking (IoU / Kalman filters) realistically require 60 FPS or higher to prevent lost tracks and duplicate counts?

​Given the budget, what would be the most reliable camera choice (e.g., USB Global Shutter module like ELP/Arducam, Raspberry Pi Global Shutter camera, or a high-end webcam with manual exposure controls like the Logitech Brio)?

​Any feedback on optimizing the capture pipeline for this type of conveyor setup would be greatly appreciated!

Note: The belt speed is adjustable


r/computervision 12h ago

Showcase Caught a slide-level data leakage bug in my histopathology classifier... accuracy dropped from a fake 99% to an honest 97.3% (CTransPath + CRC-VAL-HE-7K)

Thumbnail
gallery
Upvotes

Built a 9-class colorectal histopathology classifier. Caught a patient-level data leakage bug that was inflating validation accuracy to 99%+, rebuilt the evaluation pipeline against an independent holdout patient cohort (CRC-VAL-HE-7K), and benchmarked a pathology-native transformer (CTransPath) against an ImageNet baseline. Code, checkpoints, and calibrated weights are open source.

The Bug: Why random patch splits lie

NCT-CRC-HE-100K consists of 100,000 tissue tiles cropped from a limited number of Whole Slide Images (WSIs).

If you do a standard random train/val split at the image-file level, neighboring patches cut from the exact same slide and patient end up scattered across both sets. The model ends up memorizing patient-specific tissue morphology and staining artifacts rather than generalizable histological features.

Once evaluated strictly against an unseen, independent patient cohort (CRC-VAL-HE-7K, n = 3,590), an ImageNet-pretrained EfficientNet baseline dropped from high-90s down to 92.70%.

What Changed: Domain-Specific Pretraining & Setup

To improve generalization without relying on artificial leakage, I swapped the backbone to CTransPath:

  1. Pathology-Native Pretraining: CTransPath is a Swin-Tiny Transformer pretrained via semantically-relevant contrastive learning (SRCL) across ~15M histology patches from PAIP and TCGA.
  2. ConvStem vs. Standard PatchEmbed: Unlike standard Swin Transformers that use a linear projection, CTransPath integrates a convolutional stem (stacked 3\times3 convolutions + BatchNorm + ReLU). Note: Loading CTransPath weights into a stock timm Swin patch embed silently mismatches the input layer projection.
  3. Two-Phase Training: Linear probe on the frozen backbone first, followed by fine-tuning the top 2 stages using differential learning rates.
  4. Strict Split Protocol: Trained exclusively on NCT-CRC-HE-100K. All validation, checkpoint selection, temperature tuning, and final reporting are done strictly on CRC-VAL-HE-7K.

Benchmark on Holdout Patient Cohort (CRC-VAL-HE-7K)

Model Architecture Pretraining Domain Test Acc Macro F1
EfficientNet-B1 ImageNet-1k (Natural) 92.70% 0.8980
CTransPath (Swin-Tiny) Pathology (~15M Histology Patches) 97.33% 0.9615

Class Breakdown Highlights

  • High Confidence / Clean Separability: Lymphocytes (LYM F1: 0.995), Mucin (MUC F1: 0.994), Colorectal Adenocarcinoma (TUM F1: 0.987), Normal Mucosa (NORM F1: 0.984).
  • Where It Struggles (MUS vs. STR): Smooth Muscle (MUS, F1: 0.877) and Cancer-Associated Stroma (STR, F1: 0.833) remain the primary source of false classifications. In H&E staining, desmoplastic stroma and muscularis propria share very similar fibrillar, eosinophilic textures—pathologists often rely on IHC (e.g., SMA or Desmin) to differentiate them conclusively.

Two Engineering Fixes Worth Mentioning

  1. Fixing Grad-CAM++ on Swin Features: Standard Grad-CAM++ assumes positive, post-ReLU activations. The final Swin stage outputs signed, zero-centered features after LayerNorm. Direct gradient weighting caused denominator collapse and completely flat/washed-out heatmaps. I fixed this by computing alpha-weights on positive-clamped features (feat_map.clamp(min=0.0)) with an automatic fallback guard to standard Grad-CAM if dynamic range drops below $10{-6}.
  2. Probability Calibration (Temperature Scaling): Raw softmax outputs were over-regularized. Optimizing a post-hoc temperature scalar (T = 0.5655) on the validation subset cut Negative Log-Likelihood (NLL) by 52.2% (0.1960 \rightarrow 0.0937), producing well-calibrated confidence intervals for inference.

Links & Code

  • GitHub: Repository Link (includes training notebook, inference CLI, and Grad-CAM report generator)
  • Hugging Face Model: Model Card & Weights (dual .safetensors and .pt checkpoints)

Disclaimer: Academic/research project only. Not an FDA/CE-cleared diagnostic device and not intended for patient clinical decisions.

I'd appreciate feedback from anyone working in computational pathology:

  • How do you typically handle stain normalization (e.g., Macenko vs. Vahadane) when moving across external scanner hardware?
  • Any edge-case recommendations for stabilizing Grad-CAM across attention-based feature maps?

r/computervision 16h ago

Showcase Padel video analyze project that I'm working on

Enable HLS to view with audio, or disable this notification

Upvotes

I realize, that now once a month someones shares this kind of project, but still wanted to share :)

I wanted to make it work on regular club footage, have it working on 3 courts now. It's mostly general by now, but still requires manual calibration (10 points) on each court, or if camera have moved.

It's my first time dabling with CV, so just playing around. All of it is vibecoded, but with my direction, which is sometimes limited, because.. well, no experience with CV. I have over 10 years of dev experience in other fields, so that helps a lot.

This is an excerpt of my marking/diagnostics app (also vibecoded), two more examples here:

https://streamable.com/au93be
https://streamable.com/axz0pg

All the footage here has gone trough my review (so hits and point endings fixed, don't remember the actual state of these points, but you can see it in the bottom graph (with little square boxes) - the bottom one is the actual label, and the middle one is decoded one. I only now realized, that this might not be in the spirit of this subredit to show "fixed" footage, but it's mostly identical, and I don't have any other examples at the moment)

Some info about the project (AI generated, sorry), if you care about the tech, or want to roast it (please do!):

The pipeline takes a fixed club-camera recording of a padel match and turns it into a list of ball contacts (who hit, when) grouped into points. Every stage feeds the next.

Stages and models:
Court calibration (court_calibrate.py) — no model. A homography plus lens distortion fitted from ~10 clicked court points, so pixel positions can be converted to court metres.

Player tracking (track_players.py) — YOLO detector at 1280 px. Finds the four players each frame and assigns them to court slots (near-left, near-right, far-left, far-right).

Ball detection (track_ball_wasb.py) — WASB, a small heatmap network fine-tuned on padel footage. Run twice: a strict "event" track for kinematics and a looser "state" track only for coverage features.

Player pose (track_pose.py + far-crop pass) — YOLO11-pose, 17 keypoints. Gives wrist/body positions; far players get an upscaled crop pass because they are tiny.

Candidate generation (detect_hits_from_ball.py) — no model. Speed reversals and gaps in the ball track propose possible contact frames and attribute them to a player slot.

Strike head (strike_scores.py, strike_dense.py lattice) — a CNN on player crops around the candidate frame, trained to say "this player is striking now". Scores candidates, re-times them to the true contact frame, and recovers missed hits.

Strike-withhold mask — no model. Suppresses candidates whose attributed player is a stale, frame-clipped box (out of view).

Point decode (decode_points.py) — a Viterbi-style dynamic program over candidates. Uses two gradient-boosted-tree heads: an emission head (is this candidate a real hit) and a bounce head (is this a bounce, not a hit), plus the strike score and ~15 hand-set costs, to pick the hit sequence and open/close points.

Merge stages — join point fragments across short gaps; a small formation MLP vetoes point starts when players are not in a serving formation.

Eval (eval_hits.py) — scores against hand labels with a 6-frame hit tolerance and 12-frame point-start tolerance.

Bottom line: five learned models (WASB ball, YOLO players, YOLO11-pose, strike CNN, two GBT heads + formation MLP) produce evidence; one deterministic decoder turns that evidence into hits and points. Current in-sample pool F1 is 0.9507 across six cameras.

It has around 95% accuracy (detects 95% of hits correctly, within a specific margin). It detects and opens points with around 90% accuracy using serve formation. The problem is the point endings. I realise that it's likely where this project dies - currently I'm using the "quitness" of the ball and the players, and it works decently. But I'm fixing those manually for now, as well as the winners, so I'm able to generate extended report about the match and mistakes.

Other problem I have is long processing time. I already optimized it a bit, but I feel like I'm probobly using to much stuff. The pipeline grown naturally, by using different things to improve the decode. But I feel like I can try to delete some stuff from it. For example, skipping player pose and using strike head only, things like that. Although, I'll want pose for detecting shot types later, so.. yeah..

My current pipeline timings:

stage wall
phase A (ball dual + players + base pose, concurrent) 1h13m01s
far-crop pose 36m07s
candidates (C3) 4m13s
strike scores (fp16) 5m32s
strike dense scan (fp16) 16m14s
lattice / withhold / decode+merges / sidecar 1m59s / 8s / 28s / 7s
total 2h17m56s (1.63x realtime)

Another problem is the ball. Would love to have some suggestions, how I could get the actual 3d position of it, but my research came with nothing valuable for my case (1 camera angle).

Would love to hear any advice, directions or any other feedback. Thank you!


r/computervision 3h ago

Help: Project If you had to detect vehicles using ONLY motion detection, how would you do it? 🔍

Post image
Upvotes

I’m working on a computer-vision problem where I need to detect vehicles (cars, trucks, buses, etc.) using only traditional image-processing/computer-vision techniques.

The important constraint is:

* ❌ No YOLO / deep-learning detector

* ❌ No object detection model

* ❌ No neural networks

* ✅ Motion detection and traditional CV techniques only

The camera is fixed, so the general idea is to identify regions that correspond to moving vehicles.

I’m considering approaches such as:

* Background subtraction (MOG2 / KNN)

* Frame differencing

* Optical flow

* Contour detection

* Morphological operations

* Connected-component analysis

* Tracking detected blobs across frames

* Combining multiple motion cues

But I’m not sure what would be the most robust overall strategy, especially when dealing with:

* Shadows and lighting changes

* Rain/fog/noise

* Vehicles stopping temporarily

* Multiple vehicles overlapping

* Small vehicles at a distance

* Vehicles entering/exiting the scene

* Camera vibration

* Other moving objects such as people or birds

Would you go with something like:

Background Modeling → Motion Detection → Morphological Filtering → Contours/Connected Components → ROI/Size Filtering → Tracking → Vehicle Confirmation

Or is there a better traditional-CV approach?

I’d especially love to hear about practical approaches that have actually worked in real-world traffic/video systems, not just theoretical methods.

What would your strategy be? And what are the biggest pitfalls I should expect?


r/computervision 3h ago

Help: Project Computer Vision Person Detection

Upvotes

i need to make a person detection in which a video will be uploaded its a fixed footage no moment and it need to detect the persons give them correct id and count them even if they gets blocked and also gets out of frame and comes again teh same id should be used

also i want to count how many people went in and out of that using the virtual line and all

can anyone guide me on which model to choose or what all algorithm to choose

any open source model is enough yolo,rtdetr,cnn or anything

i am new to this and want to do this project so how to do this guys any guidance


r/computervision 1h ago

Discussion Useful Reference Guide: Watch Models, Clone Movements, and Visual Similarity Scores Chart (Translated to English)

Post image
Upvotes

Is this accurate?


r/computervision 1h ago

Discussion Looking for best segmentation model.

Upvotes

Hi, I am looking for very accurate segmentation model (instance or semantic) that can perform very good even on small objects. I want to train or full finetune the base model on my dataset. Any suggestions. I have tried sam3, uunet, rfdter. But still i am not satisfied by results. Any suggestions?


r/computervision 10h ago

Showcase Knife skill assessment

Upvotes

Hello everyone -

I wanted to know your thoughts and also recommendations of improvements on this please. I built this knife skill assessment for chopping vegetables this summer after reading several papers on cooking as a science. The goal was to find the hardest skill that required a common tool (knife) and then score it. The reason I did this was because I'd like cooks to be paid for their invisible labor and not just hourly as I know how hard that job is. But I doubt this would be beneficial lol ... Anyways, I am more than willing to go into details about what I used starting with the programming language (c++) and temporal and spatial models including how kalman filters were used here. The link to it is down below:

https://cookcredit-knife-demo.web.app/


r/computervision 4h ago

Discussion Neural Decoding vs 3D Reconstruction/Robotics

Upvotes

I'm stuck between the two fields/topic and can't decide which one to put all my eggs in for masters. A little background, I'm first semester master student doing MS AI from a university in S.Korea. Here in Korea you are expected to join a lab from the start of masters and start preparing for research from the first semester.

I originally planned to join the computer vision lab but due to unforeseen circumstances and me being a little late, I couldn't get in. So, I had no choice but to join another lab.

The main research direction of this lab is emotions and medical ai. But, the the students are working on diverse range of topics from medical (Alzheimer, Xray report, glass slides) to emotions, activity recognition, and there is one student(Phd) doing research in battery AI.

Professor has told me to figure out a direction and read current lab papers. One of my senior (post-doc) recommend the topic of neural decoding, as its a space where there is good opportunity to do meaningful contribution. Since this also fall under medical ai there are people who can guide me.

But my heart is still stuck at 3D Reconstruction+Robotics because I really wants to work in this field. I'm looking to hearing from people how much impact your master research has on your job hunting. If you were in my place how would you think about this. (Also currently no plans fob, r Phd, but can change).

Edit: Next semester computer vision lab might have opening, so If I take 3D Reconstruction/Robotics, there is a chance I can shift (that's a big If tho that I haven't discussed, because I can't talk to the professor without being sure of the topic I want to pursue).


r/computervision 5h ago

Help: Project Best free/open-source AI model for understanding screenshots?

Upvotes

I'm looking for a free vision AI/VLM that can take a screenshot and understand what's on the screen.

My requirements:

Read text from screenshots

Understand UI elements/buttons/windows

Describe what is happening on the screen

Answer questions about the screenshot

Preferably run locally

Python support would be a big plus

I don't need image generation

Smaller/faster model is preferred

What is currently the best free/open-weight vision model for this use case?

Qwen-VL, Gemma, MiniCPM, or something newer?

I'm mainly interested in screen understanding/AI computer automation, not just OCR.

Thanks!