YOLOv7 Implementation

Seong Woong Kim·2023년 12월 4일
0

Paper Implementation

목록 보기
1/2

💡
코드는 여기서 확인하실 수 있습니다.

상기 이미지를 참고해서 구현했다.

  • Backbone, Neck(Top-Down), Neck(Bottom-Up), Head로 구성했다.

YOLOv7의 모델 구조는 이런 형식으로 되어있다.



Backbone

CBS

Convolution + Batch N + SiLU

ELAN

MP-1 (Max Pooling)

pool_size, stride = (2, 2)


Neck1 (Top-Down)

Skip Connection

SPPCSPC

Spatial Pyramid Pooling + Cross Stage Partial Network

UPSample

torch.nn.Upsample(scale_factor=2, mode='nearest')

ELAN-W

ELAN과의 차이점

비고ELANELAN_W
number of blocks to concat46
Input(n, in_channels, h, w)(n, in_channels, h, w)
Output(n, in_channels * 2, h, w)(n, in_channels // 2, h, w)

Concat

torch.cat([tensor, tensor], dim=n)

  • dim으로 지정한 차원 위치 말고는 다 동일해야 함.
x1 = torch.rand(n,3,32,32)
x2 = torch.rand(n,3,32,32)

torch.cat([x1, x2], dim=0)  👉 torch.size([n+n, 3,   32,     32])
torch.cat([x1, x2], dim=1)  👉 torch.size([n,   3+3, 32,     32])
torch.cat([x1, x2], dim=2)  👉 torch.size([n,   3,   32+32,  32])
torch.cat([x1, x2], dim=3)  👉 torch.size([n+n, 3,   32,     32+32])

Neck2 (Bottom-Up)

Skip Connection

Concat

ELAN_W

MP-2

MP-1과 차이점

비고MP-1MP-2
Input(n, in_channels, h, w)(n, in_channels, h, w)
Output(n, in_channels, h // 2, w // 2)(n, in_channels * 2, h // 2, w // 2)

Head

RepConv

RepVGG

If training, identity + 1x1 conv + 3x3 conv

CBM

Conv + Batch Normalization + Sigmoid

IDetect

YOLOR’s Implicit

Regression + Classification

Output

a list consisting of 3 torch.Tensors

(batch_size, 3, h, w, number of classes +5)
3: number of anchors
5: x+y+w+h+confidence score
x,y : grid cell의 영역에 관련된 bounding box의 center를 의미
[
  torch.size([1, 3, 80, 80, 85]),
  torch.Size([1, 3, 40, 40, 85]), 
  torch.Size([1, 3, 20, 20, 85]), 
]
profile
성장과 연구하는 자세를 추구하는 AI 연구개발자

0개의 댓글

관련 채용 정보