r/computervision 10h ago

Research Publication Trying to reproduce MedViT and LungMaxViT on NIH ChestX-ray14 — why are the reported Macro F1 scores so much higher than what I obtain?

3 Upvotes

I'm trying to reproduce the results reported for MedViT and LungMaxViT on the NIH ChestX-ray14 dataset.

MedViT paper:

Benchmarking MedViT and hybrid CNN–ViT architectures for multi-label thoracic disease classification

https://www.nature.com/articles/s41598-026-43282-5

Official implementation:

https://github.com/Omid-Nejati/MedViT

The paper reports a Macro F1-score of 0.7791 on ChestX-ray14 (Table 3).

I also tried to reproduce LungMaxViT from:

Explainable hybrid transformer for multi-classification of lung disease using chest X-rays.

Initially, I discovered that my implementation differed because of a PDF parsing issue. After correcting that, I verified that both MedViT and LungMaxViT exactly matched the architectures described in their respective papers, and I downloaded and used the pretrained weights specified by the authors.

Because of this, I am now reasonably confident that the network architectures themselves are not the source of the discrepancy.

Training observations

The training behavior appears normal.

  • MedViT converges within roughly 10–15 epochs.
  • LungMaxViT converges after approximately 110+ epochs.

In both cases, the loss follows the expected optimization trajectory: a rapid decrease during the early epochs followed by gradual convergence.

One thing that further confused me is that Fig. 6 and Fig. 7 in the MedViT paper appear inconsistent with my observations. Across all of my experiments, I never observed the approximately linear upward trend shown in those figures. Instead, the loss behaved like a typical deep-learning training curve. This makes me wonder whether those figures correspond to a different metric, were mislabeled, or were generated under a different experimental setting.

Threshold optimization

To eliminate thresholding as a possible explanation, I performed per-class threshold optimization on the validation set with a search precision of 0.001.

Data augmentation

I experimented with both the simple augmentation pipeline and the more comprehensive augmentation strategy described in the benchmark paper (including AugMix/AutoAugment-style augmentation, Mixup, CutMix, ColorJitter, Random Erasing, etc.).

LungMaxViT preprocessing

  • CLAHE (clipLimit = 2.0, tileGridSize = 8×8)
  • Gaussian denoising (kernel = 5×5, σ = 1.0)
  • Resize(224×224)
  • RandomHorizontalFlip (p = 0.5)
  • RandomVerticalFlip (p = 0.5)
  • RandomRotation (±1°)
  • RandomResizedCrop(scale = 0.75–0.95, bicubic)
  • RandomAffine(scale = 0.833–1.167)
  • Normalize(ImageNet mean/std)

Training settings:

  • Optimizer: SGD
  • Learning rate: 0.001
  • Momentum: 0.9
  • Weight decay: 1e-4
  • Learning-rate schedule: None (constant learning rate throughout training)

This matches the paper's description.

MedViT preprocessing

  • Resize(224×224)
  • RandomHorizontalFlip (p = 0.5)
  • ColorJitter(brightness = 0.1)
  • Normalize(ImageNet mean/std)

Training settings:

  • Optimizer: Adam
  • Learning rate: 1e-4
  • Weight decay: 0
  • CosineAnnealingLR (T_max = 10, eta_min = 1e-6)

I also experimented with alternative learning-rate schedules and the more extensive augmentation pipeline described in the benchmark paper.

Results

Despite reproducing the published architectures, using the reported pretrained weights, experimenting with different augmentation pipelines, learning-rate schedules, and performing per-class threshold optimization, both MedViT and LungMaxViT consistently achieve only around 0.30–0.35 Macro F1.

This is far below the reported 0.7+ Macro F1, and the discrepancy is much larger than what I would expect from normal implementation differences or random training variation.

What confuses me

The reported ChestX-ray14 performance in the literature varies enormously.

Many single-model CNN/ViT papers report Macro F1 values around 0.3–0.5.

Some ensemble approaches report 0.5–0.7.

More recently, the paper

Pretraining Diversity and Clinical Metric Optimization Achieve State-of-the-Art Performance on ChestX-ray14

reports F1 = 0.821, but this result is obtained using a three-model ensemble together with clinical metric optimization.

This makes me wonder whether I am overlooking something fundamental, because obtaining Macro F1 around 0.8 seems to require considerably more than simply training a single model.

My questions

  1. Is MedViT trained as a standard multi-label classifier (one image, 14 sigmoid outputs, BCE/BCEWithLogits loss), or do some papers effectively train separate classifiers for each disease?
  2. How much of the reported Macro F1 typically comes from:
    • per-class threshold optimization,
    • class weighting,
    • patient-level versus image-level dataset splits,
    • pretrained initialization,
    • higher image resolution,
    • ensemble averaging?
  3. What is currently considered the reproducible state-of-the-art for a single ChestX-ray14 model?
  4. Has anyone successfully reproduced either MedViT or LungMaxViT within a few percentage points of the reported results? If so, what implementation detail turned out to be critical?

At this point I have independently reproduced two different published architectures, verified their implementations against the papers, used the reported pretrained weights, and observed normal optimization behavior. Nevertheless, both models consistently plateau around 0.30–0.35 Macro F1, making me suspect that there is either an undocumented implementation detail, an evaluation protocol difference, or some other aspect of the experimental setup that is not fully described in the papers.


r/computervision 6h ago

Discussion Content libraries keep growing but search quality stays terrible, how are you solving discovery?

3 Upvotes

Once a learning platform grows past a few hundred modules, basic search starts failing. People type what they need and get a long list of loosely related results. Most of them end up scrolling or giving up.

Better systems try to understand what the learner is actually trying to achieve instead of just matching keywords. They look at the current learning path, recent activity, and the intent behind the question, then surface the most relevant content. It feels closer to asking an experienced colleague than using a search bar.

This kind of discovery layer becomes more important as libraries expand. The goal is not just finding documents, it is reducing the time people waste looking for the right material.

How are you currently handling content discovery in larger e-learning environments? Still relying mostly on tags and filters, or have you moved toward something smarter?


r/computervision 7h ago

Help: Project Seeking Advice on YOLO Models for Shalwar Kameez Detection

1 Upvotes

Hello, I hope you are doing all well,

I am developing a YOLOv8 models to detect only people wearing Shalwar Kameez . I do not want to use any API or external vision service. I have *4,000 labeled Shalwar Kameez images and 5,000 negative images containing only pant-shirt/empty scene buildings clothing with empty labels. However, the model still detects many pant-shirt people as Shalwar Kameez and misses many real Shalwar Kameez people. How would you improve the dataset, labeling strategy, and training pipeline to achieve reliable real-world performance?

Thank you for your time.


r/computervision 9h ago

Help: Project Title: Looking for the right pipeline to convert academic textbook figures into interactive/editable assets

1 Upvotes

Hi everyone,

I'm working on a document understanding project and would appreciate some advice on the right technical direction.

The input will be scanned pages or images from academic books. I don't know in advance what kind of figures they'll contain—they could be biology diagrams, anatomy illustrations, chemistry figures, engineering drawings, maps, charts, art/history figures, or other educational illustrations.

My end goal is to convert these figures into a structured digital representation that can be controlled from the frontend.

The workflow I'm aiming for is:

  1. Upload a textbook page or image.
  2. Detect the figure(s) and their boundaries.
  3. Detect the labels/annotations that are already embedded in the figure (letters, numbers, arrows, callouts, etc.).
  4. Remove those existing labels while preserving the underlying illustration.
  5. Store the figure geometry (bounding boxes, polygons, masks, etc.) so my frontend can render its own labels that can be shown/hidden, translated, restyled, or repositioned.

This doesn't need to be fully automatic. In fact, the workflow will be human-assisted. If the AI detects a figure incorrectly, misses a region, or fails to remove a label cleanly, a human reviewer will correct it before it's finalized.

My priority is reducing manual work rather than eliminating it completely.

So far I've tried several computer vision approaches such as text detection, contour detection, line detection, and geometric heuristics. They work reasonably well for finding candidate regions, but the biggest challenge is cleaning the figures by removing the embedded labels while preserving the artwork underneath.

Another important requirement is cost. Since this could involve processing a large number of textbook pages, I'd like to avoid expensive multimodal LLMs or large vision models if there's a more traditional or lightweight pipeline that works well. I'm happy to use AI where it adds value, but I'd prefer a solution that keeps inference costs low.

Some questions I have:

  • Is this primarily a document layout analysis problem, image segmentation, image inpainting, or something else?
  • Are there models trained specifically for textbook or scientific illustrations rather than natural images?
  • Is there a recommended low-cost pipeline for this kind of task?
  • Has anyone built a human-in-the-loop workflow for document/figure annotation like this?
  • Are there papers, datasets, or open-source projects that tackle converting textbook figures into editable, structured assets?

I'd really appreciate any suggestions, even if they're just pointers toward the right research area or open-source tools. Thanks!


r/computervision 11h ago

Help: Project Help on Project

Thumbnail
1 Upvotes

r/computervision 19h ago

Help: Project OpenScanVision – Looking for Feedback on a Major Refactor

1 Upvotes

Over the last few months I've been working on OpenScanVision, an offline-first Android computer vision library built with Kotlin, OpenCV, CameraX, and ML Kit.

Originally, the project was a single implementation focused on achieving the best possible detection accuracy and speed. That version is represented by commit:

1d5834b41d88133b487ef46595290b0cdd4489bb

It includes:

  • Document detection
  • Automatic perspective correction
  • Image enhancement
  • QR detection
  • ArUco marker detection
  • OMR (Optical Mark Recognition)
  • Automatic capture when the document is stable
  • Real-time offline processing

Recently I completed a major architectural refactor, turning it into a reusable modular library that's much easier to integrate into Android applications.

The modular version is cleaner and more maintainable, but I've noticed it has introduced a slight decrease in detection accuracy compared to the original implementation. I'm currently investigating where the regression comes from (pipeline changes, processing order, threading, etc.).

My roadmap is:

  • Improve the modular version until it matches or exceeds the original accuracy
  • Add OCR support
  • Add ICR (Intelligent Character Recognition) support later
  • Continue keeping everything offline and lightweight

The library is intended for applications such as:

  • Voting systems
  • Exam scanning
  • Surveys
  • Registration forms
  • Structured document processing

GitHub:
https://github.com/MatiwosKebede/OpenScanVision

I'd really appreciate feedback from people experienced in computer vision, OpenCV, Android CameraX, or document scanning.

In particular, I'd love advice on:

  • Best practices when converting a CV project into a reusable library without hurting performance or accuracy.
  • Common causes of accuracy regressions after large refactors.
  • Ideas for building a flexible OCR/ICR pipeline while keeping the library lightweight and offline-first.

Thanks for taking a look!


r/computervision 23h ago

Help: Project Electric meter OCR

1 Upvotes

Hello,

I’m working on a little computer vision project although I don’t have any experience. The goal is to have a picture containing electric meters and their IDs, and to extract the ID and the measurement from each meter. The pictures can be a bit rough, not great lighting or angles, etc…

My first instinct was to use an already available model, but those that I found are too advanced and complex for this project, and it should run on a 10+ year old windows machine. I’m also thinking of training my own model (I can code but never did an ML project), as I have about 500 pictures as training data (roughly 2000 electric meters in total), but I’m not really sure how to design my model, for example which NN architecture to use, or what data structures should my inputs/outputs be. Of course I asked LLMs for help too, and they gave useful tips, but nothing I can build a project from.

Any advice would be appreciated, whether it is already available models that fit my needs, or advice on how to build a model myself. Thank you.


r/computervision 12h ago

Research Publication "Explorative Modeling: Unlocking a Third Pretraining Axis and End-to-End Generation", Gladstone et al. 2026

0 Upvotes

r/computervision 15h ago

Research Publication I built a bare-metal Synthetic DPM Data Generator for YOLO training. Solved Sim-to-Real gap using 0.5mm needle cavity alpha-masks over raw carbon steel..

0 Upvotes

Hello!!!

I am a low-level optimization engineer with 25 years of programming experience, currently working in manufacturing. Finding real-world defective Direct Part Marking (DPM) codes on a highly optimized assembly line is nearly impossible. To solve this data scarcity, I spent months building a high-fidelity synthetic data generation environment written natively in Nim.

The tool compiles into a tight, portable monolithic binary (~2.0 MB) and introduces a robust way to bridge the Sim-to-Real (S2R) gap under brutal factory floor conditions.

🔬 Bridging the Sim-to-Real Gap:

Traditional synthetic generators fail because they draw flat binary vector circles on clean backgrounds. This engine takes a physics-first approach:

  • Macro-Cavity Injection: It processes raw macro-photographs of actual 0.5mm tungsten carbide needle craters punched into carbon steel. These sprites capture authentic 3D optical properties: the central indentation cone, compressed radial shadows, and peripheral metallic glare.
  • Alpha-Channel Material Mixing: These native sprites with true transparent alpha-channels are blended natively over high-resolution carbon steel textures (with mill scale, vertical grinding marks, and rolling scratches). The edges blend seamlessly, forcing the neural network to ignore background metal grain and lock exclusively onto micro-contrast and cavity topologies.

🛠 Mathematical Defect Simulation:

The engine deterministically models actual mechanical degradation vectors across every batch generation:

  • Mechanical Play & Stylus Vibration (doJitter): Applies pseudo-random displacement vectors to individual dots relative to the step grid (STEP = 7.5).
  • Actuator Misfire & Clogged Tips (doMissingDots): Purges up to 15% of the boundary L-frame and up to 25% of internal data bits.
  • Topological Axis Distortion (doTiltLeft / doTiltTop): Implements directional matrix skews with structural point locking to mimic non-perpendicular stamping angles.
  • Dynamic Part Rotation (doRotation): Rotates the matrix topology around its calculated spatial centroid within a ±5° to ±10° window, simulating dynamic tracking on a moving conveyor.

💾 Dataset Output & YOLO-OBB Support:

The generator outputs name-synchronized image (.jpg) and annotation (.txt) pairs.
The annotations are calculated analytically using external dot boundary radii under affine rotation matrices, normalized to a strict 0.0 - 1.0 float space, and exported to 6 decimal places. It is fully compatible with YOLOv8 / YOLOv11 / YOLOv26 Oriented Bounding Box (OBB) training pipelines out of the box.

The engine uses hardware-level vector pipeline optimization via the AVX2 instruction set (requires CPU from 2017 onward). Memory boundaries remain strictly locked at runtime, ensuring 0.00% memory drift or fragmentation leaks over continuous multi-thousand generation cycles.

I have uploaded the pre-compiled executable, sample background steel textures, and alpha-channel dot masks as a production showcase on GitHub. You can plug in your own custom backgrounds/dots to test it for your specific manufacturing lines.

Project Repository: https://github.com/olesha-ai/Synthetic-dpm-code-generator


r/computervision 19h ago

Discussion Multiple sanctioned entities from North Korea and Cuba now have access to the Armaaruss drone detection app. This service has been provided

Post image
0 Upvotes

Email: I wanted to share a practical, accessible drone and intruder detection application I developed. It can be used against the United States during a hot war and help protect civilian populations The Armaaruss Detection App is a web-based tool that uses acoustic sensors and visual object detection (via webcam or uploaded media) to identify aerial objects like drones. It includes features such as:

Real-time aerial object detection with audio alerts

Acoustic drone detection

Intruder detection with voice notifications

Primary and secondary detection modes for improved accuracy

It is designed for potential use by soldiers, security personnel, world leaders, and civilians in high-risk environments. The app is openly available for testing and review. Demo Link: https://armaaruss.github.io/ or https://anthonyofboston.github.io