HVI-CIDNet Tiny
Fit diagram
Read at 100%
Clear selection
Download SVG
Download PNG
Click a block to read its description, or select it with Tab and Enter.
HVI-CIDNet Tiny
Low-light RGB restoration,input3 × 256 × 256,native eval. Shapes exclude batch.
LibreYOLO
HVI-CIDNet Tiny
Low-light RGB restoration,input3 × 256 × 256,native eval. Shapes exclude batch.
Learned HVI color transform
Input RGB
3 × 256 × 256
Channel max/min and piecewise hue
I=max(R,G,B); S=(max-min)/(max+1e-8)
Color-sensitive factor Ck
(sin(Iπ/2)+1e-8)^k; learnedk initially0.2
Concat horizontal,vertical,intensity
H=Ck*S*cos(2πh); V=Ck*S*sin(2πh); I
Hue is HSV sector hue from the maximal RGB channel.
For achromatic pixels h=0; for I=0,saturation=0.
HVI has3 channels. Intensity stream selects channel2.
Concat predicted HV andI residuals
2 channels +1 channel =3 × 256 × 256
+
PHVIT inverse color transform
Clamp,HVI-to-HSV reconstruction,HSV-to-RGB
Restored RGB
3 × 256 × 256
Default saturation_scale=intensity_scale=1.
HV encoder and decoder
ReplicationPad1;Conv3×3
3 to36;256²; skipJ0
Downsample1
36 to36;128²; paired contextLCA1
HV_LCA1
36 channels,2 heads; resultskipJ1
Downsample2
36 to72;64²; paired contextLCA2
HV_LCA2 (skip-only)
72 channels,4 heads; resultskipJ2
Downsample3 from pre-LCA2 feature
72 to144;32²
HV_LCA3
144 channels,8 heads
HV_LCA4
144 channels,8 heads; usespairedLCA3 outputs
Upsample3 + skipJ2
144 to72;64²
HV_LCA5
72 channels,4 heads
Upsample2 + skipJ1
72 to36;128²; reads LCA5 output
HV_LCA6
36 channels,2 heads
Upsample1 + skipJ0
36 to36;256²
ReplicationPad1;Conv3×3
36 to2;256²
Contexts are the paired stream features before each LCA update.
I encoder and decoder
ReplicationPad1;Conv3×3
1 to36;256²; skipJ0
Downsample1
36 to36;128²; paired contextLCA1
I_LCA1
36 channels,2 heads; resultskipJ1
Downsample2
36 to72;64²; paired contextLCA2
I_LCA2 (skip-only)
72 channels,4 heads; resultskipJ2
Downsample3 from pre-LCA2 feature
72 to144;32²
I_LCA3
144 channels,8 heads
I_LCA4
144 channels,8 heads; usespairedLCA3 outputs
Upsample3 + skipJ2
144 to72;64²
I_LCA5 (result unused)
72 channels,4 heads
Upsample2 + skipJ1
72 to36;128²; reads pre-LCA5 feature
I_LCA6
36 channels,2 heads
Upsample1 + skipJ0
36 to36;256²
ReplicationPad1;Conv3×3
36 to1;256²
Contexts are the paired stream features before each LCA update.
CAB channel cross-attention
C/heads:36/2,72/4,144/8. Every head has18 channels.
Conv2d1×1 fromX
36/72/144 tosame
DepthwiseConv3×3
Groups=outputchannels;s1,p1
Conv2d1×1 fromcontext
36/72/144 to72/144/288
DepthwiseConv3×3
Groups=outputchannels;s1,p1
Split K,V; L2-normalize Q and K
Normalize over spatial length, not channels
Q × transpose(K) × learned temperature
18 × 18 channel-attention matrix per head
Softmax over key channels
18 × 18 perhead
Attention × V
Restore36/72/144 spatial channels
Conv2d1×1
36/72/144 to samechannels
V is the unchanged value half of the KV depthwise projection.
All CAB convolutions use bias=False.
LCA residual structure
Feature X and paired context
36,72 or144 channels
Shared channel LayerNorm on both
epsilon1e-6; own module per LCA
CAB
Context supplies K/V; X supplies Q
+
Channel LayerNorm
Same LCA norm module
IEL intensity-enhancement layer
Hidden widths95,191,383 respectively
HV_LCA output
IEL result; no secondskip
+
I_LCA output
HV and I differ in the second residual connection.
IEL
Conv2d1×1
36/72/144 to190/382/766
DepthwiseConv3×3
190/382/766 channels/groups;s1,p1
Split equal halves
Each half95/191/383 channels
DepthwiseConv3×3
95/191/383 groups;s1,p1
Tanh
+
Half
DepthwiseConv3×3
95/191/383 groups;s1,p1
Tanh
+
Half
×
Conv2d1×1
95/191/383 to36/72/144
hidden=floor(2.66*C); two residual Tanh branches multiply.
Downsample and upsample
Downsample:Conv3×3
36to36,36to72,72to144;s1,p1;biasFalse
Bilinear resize×0.5
align_corners=True
PReLU
One learned slope; no optionalLayerNorm
Upsample:Conv3×3
144to72,72to36,36to36;s1,p1
Bilinear resize×2
align_corners=True
Concat with matching skip
144,72,72 channels respectively
Conv1×1 thenPReLU
144to72,72to36,72to36; noLayerNorm
All sampling convolutions have bias=False; nearest-neighbor upsampling is not used.
PHVIT inverse transform
Clamp H,V to[-1,1], I to[0,1]
Recompute Ck from I and stored density k
Divide H,V by Ck+1e-8
Clamp normalized H,V again to[-1,1]
atan2(V+eps,H+eps)/(2π) modulo1
Hue; saturation=sqrt(H²+V²+eps),clamped[0,1]
HSV sector conversion
Six sector choices using I, I(1-S), q andt
RGB output × intensity_scale
Default intensity_scale=saturation_scale=1
The inverse uses the same learned density k captured during the forward HVI transform.
Source: libreyolo/models/hvi_cidnet/nn.py and model.py. Revision a4d0ecc9e17f.
libreyolo.com