โโโโโโโโโโ โโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโ โโโโ โโโ
โโโโโโโโโโโ โโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ
โโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโ โโโ
โโโ โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโ โโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ
โโโโโโโ โโโโโโโ โโโโโ โโโโโโโโโโโโโโ โโโโโโโ โโโ โโโโโ
E N G I N E
High-Performance Native Computer Vision for the Edge.
CuVision-Engine is a low-latency Computer Vision framework written in C++ and CUDA. By targeting cuDNN and cuBLAS primitives directly, it achieves peak hardware utilisation on NVIDIA GPUs โ no PyTorch, no TensorFlow, no framework overhead.
Module Status Technique
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Classification โโโโโโโโโโ 100% 2-Stage CNN + BN + Dropout
Object Detection โโโโโโโโโโ 85% RetinaNet-FPN (ResNet backbone)
Segmentation โโโโโโโโโโ 85% Attention U-Net + ASPP Bottleneck
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TensorRT Integration โโโโโโโโโโ 0% (planned)
Instance Segmentation โโโโโโโโโโ 0% (planned)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ CuVision-Engine โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ CLASSIFICATION โ โ OBJECT DETECTION โ โ SEGMENTATION โ โ
โ โ โ โ โ โ โ โ
โ โ Input [B,C,32,32] โ โ Input [B,C,300,300] โ โ Input [B,C,256 โ โ
โ โ โ โ โ โ โ โ ร256] โ โ
โ โ 2รConvBlock โ โ ResNet Backbone โ โ ResNet Encoder โ โ
โ โ (BN+ReLU+Pool) โ โ (4 stages, stride2) โ โ (4 stages) โ โ
โ โ โ โ โ โ โ โ โ โ โ
โ โ Dropout โ โ FPN Neck โ โ Dilated ASPP โ โ
โ โ โ โ โ (P2, P3, P4 @ 256) โ โ Bottleneck โ โ
โ โ FC Layer โ โ โ โ โ โ โ โ
โ โ โ โ โ Shared Det. Head โ โ Attn U-Net โ โ
โ โ Softmax โ โ (cls + reg towers) โ โ Decoder ร3 โ โ
โ โ โ โ โ โ โ โ โ โ โ
โ โ Cross-Entropy โ โ Focal + SmoothL1 โ โ CE + Dice Loss โ โ
โ โ Loss โ โ Loss โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ SHARED FOUNDATION โโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Momentum-SGD kernel โ He init โ BN (train/infer) โ Dropout โ โ
โ โ cuRAND augmentation โ cuBLAS โ cudnnConvolution โ GpuTimer โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CU_NN/
โ
โโโ README.md โ You are here
โโโ LICENSE MIT
โ
โโโ classification/ โ
COMPLETE
โ โโโ main.cu Training loop (CE loss, step-LR)
โ โโโ compile.ps1 NVCC build โ dnn_classifier.exe
โ โโโ README.md Architecture + math + paper refs
โ โโโ dataset/
โ โ โโโ prepare_dataset.py Oxford 17-Flowers โ flowers10.bin
โ โโโ network/
โ โโโ cudnn_helper.h Error macros (CUDA / cuDNN / cuBLAS)
โ โโโ utilities.cu GpuTimer, printDeviceInformation
โ โโโ augmentation.cu H-flip + brightness jitter kernel
โ โโโ network.cu ImageClassifier class (fwd + bwd + save)
โ
โโโ object_detection/ ๐ถ IN PROGRESS (network complete)
โ โโโ main.cu Training loop (IoU match, cosine-LR)
โ โโโ compile.ps1 NVCC build โ od_detector.exe
โ โโโ README.md Architecture + math + paper refs
โ โโโ dataset/
โ โ โโโ prepare_dataset.py Pascal VOC 2007 โ od_voc2007.bin
โ โโโ network/
โ โโโ cudnn_helper.h Error macros
โ โโโ utilities.cu Smooth-L1, Focal loss, NMS, Anchors
โ โโโ augmentation.cu H-flip (bbox-aware), jitter, noise, cutout
โ โโโ network.cu ObjectDetector (backboneโFPNโhead)
โ
โโโ segmentation/ ๐ถ IN PROGRESS (network complete)
โโโ main.cu Training loop (mIoU tracking, poly-LR)
โโโ compile.ps1 NVCC build โ seg_unet.exe
โโโ README.md Architecture + math + paper refs
โโโ dataset/
โ โโโ prepare_dataset.py Oxford-IIIT Pet โ seg_pets.bin
โโโ network/
โโโ cudnn_helper.h Error macros
โโโ utilities.cu Pixel CE, Dice loss, mIoU, weight I/O
โโโ augmentation.cu Paired H/V flip, elastic deform, noise
โโโ network.cu SegmentationNet (encoderโASPPโattn decoder)
โโ Parameters (log scale) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Classification โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ~60 K
Object Detection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ~21 M (ResNet + FPN + Head)
Segmentation โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ~31 M (ResNet + ASPP + UNet)
โโ Input Resolution โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Classification โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 32ร32
Object Detection โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 300ร300
Segmentation โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 256ร256
โโ Anchors / Output Pixels โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Classification โโ (single label per image)
Object Detection ~60,000 anchors across P2+P3+P4
Segmentation 65,536 pixels labelled per image
Kernel Module(s) Purpose
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
applyMomentumSGD All v โ ฮผv + lrยทg; w โ w โ v
setConst / fillConst All GPU buffer zero / fill
augmentBatchKernel Classification H-flip + brightness (fused)
horizontalFlipKernel Object Det. Paired pixel swap (NCHW)
colorJitterKernel Object Det. Brightness/contrast/saturation
gaussianNoiseKernel OD + Seg Additive noise via cuRAND
cutoutKernel Object Det. Square region zeroing
segHFlipKernel Segmentation H-flip: image + int mask
segVFlipKernel Segmentation V-flip: image + int mask
segColorJitterKernel Segmentation Color jitter (image only)
segGaussianNoiseKernel Segmentation Noise (image only)
elasticSampleKernel Segmentation Bilinear warp + NN mask sample
upsample2xKernel Segmentation Bilinear 2ร upscale
concatKernel Segmentation Channel-wise concat
attentionScaleKernel Segmentation ฯ โ skip features
focalLossKernel Object Det. โฮฑ(1โpโ)^ฮณ log(pโ)
smoothL1LossKernel Object Det. Huber regression loss
pixelCrossEntropyLossKernel Segmentation Pixel-wise CE + softmax grad
diceLossFwdKernel Segmentation |PโฉG| / (|P|+|G|) via atomics
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total custom kernels: 20
Classification Detection Segmentation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Backbone 2-stage CNN ResNet-4 ResNet-4
Skip connections โ โ (residual) โ (residual)
Multi-scale output โ โ (FPN) โ
Attention mechanism โ โ โ (additive)
Dilated convolution โ โ โ (ASPP ร2)
Batch Normalisation โ โ โ
Dropout โ (0.5 FC) โ โ
He Initialisation โ โ โ
Momentum SGD โ โ โ
Weight Decay (L2) โ โ โ
LR Schedule Step ร0.8/ep Cosine Polynomial^0.9
Augmentation flip+bright flip+jitter elastic+flip
+noise+cut +noise+jitter
Loss Softmax CE Focal+SmoothL1 CE+Dice
Metric Accuracy mAP (IoU) mIoU
Dataset Oxford Flowers Pascal VOC07 Oxford-IIIT Pet
Classes 10 20 3
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ Classification: Step Decay (ร0.8 / epoch) โโโโโโโโโโโโโโโโโโโโโโ
lr 0.010 โคโโโโโโโโโโโโโ
0.008 โค โโโโโโโโโโโโ
0.006 โค โโโโโโโโโโ
0.004 โค โโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ epoch
1 2 3 4 5
โโ Object Detection: Cosine Annealing โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
lr 0.001 โคโโโโโโโ
0.000 โค โฒ โฒ
โค โฒ โฒ__
โค โฒ โฒ___
โค โฒ โฒ______โโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ epoch
1 2 3 4 5 6 ... 10
โโ Segmentation: Polynomial Decay (power=0.9) โโโโโโโโโโโโโโโโโโโโโ
lr 5e-4 โคโโโโโ
4e-4 โค โฒโโโโ
3e-4 โค โฒโโโโโ
2e-4 โค โฒโโโโโโ
1e-4 โค โฒโโโโโโโโโโ
โค โฒโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ epoch
1 3 5 7 9 11 13 15
CLASSIFICATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Raw batch [B, 3, 32, 32]
โ
โโโ[augmentBatchKernel]โโ H-flip (50%) + Brightness ยฑ0.15
(1 kernel, in-place, fused)
OBJECT DETECTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Raw batch [B, 3, 300, 300] Bounding Boxes
โ โ
โโโ[horizontalFlipKernel]โโโโโโโโโโโโโโโโ x' = 1 โ x
โโโ[colorJitterKernel] bright/contrast/saturation
โโโ[gaussianNoiseKernel] ฯ โ [0, 0.04] (cuRAND)
โโโ[cutoutKernel] random 15โ25% square zeroed
SEGMENTATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Image [B, 3, 256, 256] + Mask [B, 256, 256] (int)
โ โ
โโโ[segHFlipKernel]โโโโโโโโโโ pixel swap + label swap
โโโ[segVFlipKernel]โโโโโโโโโโ pixel swap + label swap
โโโ[segColorJitterKernel]โโโโ image only
โโโ[segGaussianNoiseKernel]โโ image only (cuRAND)
โโโ[elasticSampleKernel]โโโโโ bilinear image + NN mask
(displacement ฮฑ=8, ฯ=4)
Focal Loss (Object Detection โ classification head)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
weight
1.0 โค *
โค *
0.8 โค *
โค *
0.4 โค *
โค *
0.1 โค * โ easy (pโ=0.9) down-weighted to ~0.01
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ pโ
0.0 0.1 0.3 0.5 0.7 0.9 1.0
(1-pโ)^ฮณ with ฮณ=2.0: easy negatives โ near-zero gradient
Smooth-L1 (Object Detection โ regression head)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
loss
2.0 โค / โ linear (|ฮด|โ0.5)
โค /
1.0 โค /
โค โญโโโฎ โ quadratic (0.5ฮดยฒ)
0.0 โคโโโโโโโฏ โฐโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบ ฮด
-2 -1 0 1 2
Dice Loss (Segmentation)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Dice = 1 โ (2|PโฉG|) / (|P|+|G|)
Overlap |PโฉG|/|PโชG| vs Dice score
0.0 โ Dice = 1.0 (worst)
0.5 โ Dice = 0.67
0.8 โ Dice = 0.33
1.0 โ Dice = 0.0 (perfect overlap)
โ
DONE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[x] 2-Stage CNN Classifier (ConvโBNโReLUโPool ร2 + FC)
[x] Batch Normalization (training + inference running stats)
[x] Dropout Regularization (50%, inverted)
[x] He (Kaiming) Normal weight initialisation
[x] Custom Momentum-SGD CUDA kernel (per-param velocity)
[x] L2 Weight Decay (fused into SGD kernel)
[x] GPU Timer (cudaEvent benchmark utility)
[x] Oxford 17-Flowers dataset loader (binary format)
[x] CUDA augmentation: H-flip + brightness jitter
[x] ResNet-style backbone (4 stages, residual blocks)
[x] Feature Pyramid Network (FPN) neck
[x] RetinaNet detection head (shared cls + reg towers)
[x] Sigmoid Focal Loss (ฮฑ=0.25, ฮณ=2.0)
[x] Smooth-L1 (Huber) regression loss
[x] Anchor generation (multi-scale, multi-ratio)
[x] IoU-based anchor matching + delta encoding
[x] Non-Maximum Suppression (host-side)
[x] Object detection augmentation (flip/jitter/noise/cutout)
[x] Pascal VOC 2007 dataset loader
[x] Attention U-Net decoder with additive attention gates
[x] Dilated convolution bottleneck (ASPP-style, d=2,4)
[x] Pixel-wise cross-entropy loss (in-kernel numerically stable)
[x] Dice loss (atomicAdd accumulation)
[x] mIoU metric (per-class intersection-over-union)
[x] Bilinear 2ร upsample CUDA kernel
[x] Channel-wise concatenation CUDA kernel
[x] Elastic deformation augmentation (paired image+mask)
[x] Oxford-IIIT Pet dataset loader (trimap โ class mask)
[x] Polynomial + cosine LR schedules
[x] Checkpoint saving (every N epochs)
[x] Full documentation (README per module, ASCII diagrams, paper refs)
๐ถ REMAINING โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[ ] FPN lateral add + spatial upsample (GPU elementwise kernel)
[ ] Detection head full forward per FPN level
[ ] Segmentation decoder full bilinear dispatch per stage
[ ] mAP evaluation (mean Average Precision, PASCAL VOC protocol)
[ ] Inference-only mode (load weights, no grad buffers)
[ ] ONNX weight export for TensorRT ingestion
[ ] TensorRT integration (INT8 / FP16 engine for edge deployment)
[ ] Instance segmentation (Mask R-CNN style)
[ ] Multi-GPU support (NCCL all-reduce)
Minimum: NVIDIA Pascal GPU (sm_60) | 8 GB VRAM | CUDA 11+
Recommend: NVIDIA Ampere (sm_86) | 16 GB VRAM | CUDA 12+
Edge: NVIDIA Jetson Xavier/Orin | 8 GB unified
# Classification
cd classification && .\compile.ps1 && .\dnn_classifier.exe
# Object Detection
cd object_detection && .\compile.ps1 && .\od_detector.exe
# Segmentation
cd segmentation && .\compile.ps1 && .\seg_unet.exe# Each module includes a self-contained download script
python classification/dataset/prepare_dataset.py # Oxford 17-Flowers ~60 MB
python object_detection/dataset/prepare_dataset.py # Pascal VOC 2007 ~439 MB
python segmentation/dataset/prepare_dataset.py # Oxford-IIIT Pet ~800 MB| Module | Paper | Authors | Venue | Link |
|---|---|---|---|---|
| All | Batch Normalization | Ioffe & Szegedy | ICML 2015 | arXiv:1502.03167 |
| All | He (Kaiming) Initialization | He et al. | ICCV 2015 | arXiv:1502.01852 |
| All | Momentum SGD | Sutskever et al. | ICML 2013 | ICML |
| All | cuDNN: Efficient Primitives | Chetlur et al. | 2014 | arXiv:1410.0759 |
| Classification | Dropout | Srivastava et al. | JMLR 2014 | JMLR |
| Classification | AlexNet | Krizhevsky et al. | NeurIPS 2012 | NIPS |
| Classification | VGGNet | Simonyan & Zisserman | ICLR 2015 | arXiv:1409.1556 |
| Detection + Seg | Deep Residual Learning | He et al. | CVPR 2016 | arXiv:1512.03385 |
| Detection | Feature Pyramid Networks | Lin et al. | CVPR 2017 | arXiv:1612.03144 |
| Detection | Focal Loss / RetinaNet | Lin et al. | ICCV 2017 | arXiv:1708.02002 |
| Detection | SSD | Liu et al. | ECCV 2016 | arXiv:1512.02325 |
| Detection | Fast R-CNN (Smooth-L1) | Girshick | ICCV 2015 | arXiv:1504.08083 |
| Detection | Cutout | DeVries & Taylor | 2017 | arXiv:1708.04552 |
| Segmentation | U-Net | Ronneberger et al. | MICCAI 2015 | arXiv:1505.04597 |
| Segmentation | Attention U-Net | Oktay et al. | MIDL 2018 | arXiv:1804.03999 |
| Segmentation | DeepLab v3+ | Chen et al. | ECCV 2018 | arXiv:1802.02611 |
| Segmentation | Dilated Convolutions | Yu & Koltun | ICLR 2016 | arXiv:1511.07122 |
| Segmentation | V-Net / Dice Loss | Milletari et al. | 3DV 2016 | arXiv:1606.04797 |
| Segmentation | Elastic Deformation | Simard et al. | ICDAR 2003 | IEEE |
Distributed under the MIT License. See LICENSE for more information.