Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

yolov3.py 998 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  1. #!/usr/bin/env python3
  2. # -*- coding:utf-8 -*-
  3. # Copyright (c) Megvii, Inc. and its affiliates.
  4. import os
  5. import torch.nn as nn
  6. from yolox.exp import Exp as MyExp
  7. class Exp(MyExp):
  8. def __init__(self):
  9. super(Exp, self).__init__()
  10. self.depth = 1.0
  11. self.width = 1.0
  12. self.exp_name = os.path.split(os.path.realpath(__file__))[1].split(".")[0]
  13. def get_model(self, sublinear=False):
  14. def init_yolo(M):
  15. for m in M.modules():
  16. if isinstance(m, nn.BatchNorm2d):
  17. m.eps = 1e-3
  18. m.momentum = 0.03
  19. if "model" not in self.__dict__:
  20. from yolox.models import YOLOX, YOLOFPN, YOLOXHead
  21. backbone = YOLOFPN()
  22. head = YOLOXHead(self.num_classes, self.width, in_channels=[128, 256, 512], act="lrelu")
  23. self.model = YOLOX(backbone, head)
  24. self.model.apply(init_yolo)
  25. self.model.head.initialize_biases(1e-2)
  26. return self.model
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...