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

welcome.html 63 KB

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
  1. <!DOCTYPE html>
  2. <html class="writer-html5" lang="en" >
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Version 3 is out! Notebooks have been updated! &mdash; SuperGradients 3.0.2 documentation</title>
  7. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  8. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/graphviz.css" type="text/css" />
  10. <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  11. <!--[if lt IE 9]>
  12. <script src="_static/js/html5shiv.min.js"></script>
  13. <![endif]-->
  14. <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
  15. <script src="_static/jquery.js"></script>
  16. <script src="_static/underscore.js"></script>
  17. <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
  18. <script src="_static/doctools.js"></script>
  19. <script src="_static/sphinx_highlight.js"></script>
  20. <script src="_static/js/theme.js"></script>
  21. <link rel="index" title="Index" href="genindex.html" />
  22. <link rel="search" title="Search" href="search.html" />
  23. <link rel="next" title="Common package" href="super_gradients.common.html" />
  24. <link rel="prev" title="Welcome to SuperGradients’s documentation!" href="index.html" />
  25. </head>
  26. <body class="wy-body-for-nav">
  27. <div class="wy-grid-for-nav">
  28. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  29. <div class="wy-side-scroll">
  30. <div class="wy-side-nav-search" >
  31. <a href="index.html" class="icon icon-home"> SuperGradients
  32. </a>
  33. <div role="search">
  34. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  35. <input type="text" name="q" placeholder="Search docs" />
  36. <input type="hidden" name="check_keywords" value="yes" />
  37. <input type="hidden" name="area" value="default" />
  38. </form>
  39. </div>
  40. </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
  41. <p class="caption" role="heading"><span class="caption-text">Welcome To SuperGradients</span></p>
  42. <ul class="current">
  43. <li class="toctree-l1 current"><a class="current reference internal" href="#">Version 3 is out! Notebooks have been updated!</a></li>
  44. <li class="toctree-l1"><a class="reference internal" href="#build-with-supergradients">Build with SuperGradients</a><ul>
  45. <li class="toctree-l2"><a class="reference internal" href="#support-various-computer-vision-tasks">Support various computer vision tasks</a></li>
  46. <li class="toctree-l2"><a class="reference internal" href="#ready-to-deploy-pre-trained-sota-models">Ready to deploy pre-trained SOTA models</a><ul>
  47. <li class="toctree-l3"><a class="reference internal" href="#all-computer-vision-models-pretrained-checkpoints-can-be-found-in-the-model-zoo">All Computer Vision Models - Pretrained Checkpoints can be found in the Model Zoo</a></li>
  48. <li class="toctree-l3"><a class="reference internal" href="#classification">Classification</a></li>
  49. <li class="toctree-l3"><a class="reference internal" href="#semantic-segmentation">Semantic Segmentation</a></li>
  50. <li class="toctree-l3"><a class="reference internal" href="#object-detection">Object Detection</a></li>
  51. </ul>
  52. </li>
  53. <li class="toctree-l2"><a class="reference internal" href="#easy-to-train-sota-models">Easy to train SOTA Models</a><ul>
  54. <li class="toctree-l3"><a class="reference internal" href="#plug-and-play-recipes">Plug and play recipes</a></li>
  55. </ul>
  56. </li>
  57. <li class="toctree-l2"><a class="reference internal" href="#production-readiness">Production readiness</a></li>
  58. </ul>
  59. </li>
  60. <li class="toctree-l1"><a class="reference internal" href="#quick-installation">Quick Installation</a></li>
  61. <li class="toctree-l1"><a class="reference internal" href="#what-s-new">What’s New</a></li>
  62. <li class="toctree-l1"><a class="reference internal" href="#coming-soon">Coming soon</a></li>
  63. <li class="toctree-l1"><a class="reference internal" href="#table-of-content">Table of Content</a></li>
  64. <li class="toctree-l1"><a class="reference internal" href="#getting-started">Getting Started</a><ul>
  65. <li class="toctree-l2"><a class="reference internal" href="#start-training-with-just-1-command-line">Start Training with Just 1 Command Line</a></li>
  66. <li class="toctree-l2"><a class="reference internal" href="#quickly-load-pre-trained-weights-for-your-desired-model-with-sota-performance">Quickly Load Pre-Trained Weights for Your Desired Model with SOTA Performance</a></li>
  67. <li class="toctree-l2"><a class="reference internal" href="#id1">Classification</a><ul>
  68. <li class="toctree-l3"><a class="reference internal" href="#transfer-learning">Transfer Learning</a></li>
  69. </ul>
  70. </li>
  71. <li class="toctree-l2"><a class="reference internal" href="#id2">Semantic Segmentation</a><ul>
  72. <li class="toctree-l3"><a class="reference internal" href="#quick-start">Quick Start</a></li>
  73. <li class="toctree-l3"><a class="reference internal" href="#id3">Transfer Learning</a></li>
  74. <li class="toctree-l3"><a class="reference internal" href="#how-to-connect-custom-dataset">How to Connect Custom Dataset</a></li>
  75. </ul>
  76. </li>
  77. <li class="toctree-l2"><a class="reference internal" href="#id4">Object Detection</a><ul>
  78. <li class="toctree-l3"><a class="reference internal" href="#id5">Transfer Learning</a></li>
  79. <li class="toctree-l3"><a class="reference internal" href="#id6">How to Connect Custom Dataset</a></li>
  80. </ul>
  81. </li>
  82. <li class="toctree-l2"><a class="reference internal" href="#how-to-predict-using-pre-trained-model">How to Predict Using Pre-trained Model</a><ul>
  83. <li class="toctree-l3"><a class="reference internal" href="#segmentation-detection-and-classification-prediction">Segmentation, Detection and Classification Prediction</a></li>
  84. </ul>
  85. </li>
  86. </ul>
  87. </li>
  88. <li class="toctree-l1"><a class="reference internal" href="#advanced-features">Advanced Features</a><ul>
  89. <li class="toctree-l2"><a class="reference internal" href="#knowledge-distillation-training">Knowledge Distillation Training</a></li>
  90. <li class="toctree-l2"><a class="reference internal" href="#recipes">Recipes</a><ul>
  91. <li class="toctree-l3"><a class="reference internal" href="#why-use-ddp">Why use DDP ?</a></li>
  92. <li class="toctree-l3"><a class="reference internal" href="#how-does-it-work">How does it work ?</a></li>
  93. <li class="toctree-l3"><a class="reference internal" href="#how-to-use-it">How to use it ?</a></li>
  94. <li class="toctree-l3"><a class="reference internal" href="#calling-functions-on-a-single-node">Calling functions on a single node</a></li>
  95. <li class="toctree-l3"><a class="reference internal" href="#good-to-know">Good to know</a></li>
  96. </ul>
  97. </li>
  98. </ul>
  99. </li>
  100. <li class="toctree-l1"><a class="reference internal" href="#installation-methods">Installation Methods</a><ul>
  101. <li class="toctree-l2"><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
  102. <li class="toctree-l2"><a class="reference internal" href="#id7">Quick Installation</a></li>
  103. </ul>
  104. </li>
  105. <li class="toctree-l1"><a class="reference internal" href="#implemented-model-architectures">Implemented Model Architectures</a><ul>
  106. <li class="toctree-l2"><a class="reference internal" href="#image-classification">Image Classification</a></li>
  107. <li class="toctree-l2"><a class="reference internal" href="#id8">Semantic Segmentation</a></li>
  108. <li class="toctree-l2"><a class="reference internal" href="#id9">Object Detection</a></li>
  109. </ul>
  110. </li>
  111. <li class="toctree-l1"><a class="reference internal" href="#documentation">Documentation</a></li>
  112. <li class="toctree-l1"><a class="reference internal" href="#contributing">Contributing</a></li>
  113. <li class="toctree-l1"><a class="reference internal" href="#citation">Citation</a></li>
  114. <li class="toctree-l1"><a class="reference internal" href="#community">Community</a></li>
  115. <li class="toctree-l1"><a class="reference internal" href="#license">License</a></li>
  116. <li class="toctree-l1"><a class="reference internal" href="#deci-platform">Deci Platform</a></li>
  117. </ul>
  118. <p class="caption" role="heading"><span class="caption-text">Technical Documentation</span></p>
  119. <ul>
  120. <li class="toctree-l1"><a class="reference internal" href="super_gradients.common.html">Common package</a></li>
  121. <li class="toctree-l1"><a class="reference internal" href="super_gradients.training.html">Training package</a></li>
  122. </ul>
  123. </div>
  124. </div>
  125. </nav>
  126. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
  127. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  128. <a href="index.html">SuperGradients</a>
  129. </nav>
  130. <div class="wy-nav-content">
  131. <div class="rst-content">
  132. <div role="navigation" aria-label="Page navigation">
  133. <ul class="wy-breadcrumbs">
  134. <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
  135. <li>Version 3 is out! Notebooks have been updated!</li>
  136. <li class="wy-breadcrumbs-aside">
  137. <a href="_sources/welcome.md.txt" rel="nofollow"> View page source</a>
  138. </li>
  139. </ul>
  140. <hr/>
  141. </div>
  142. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  143. <div itemprop="articleBody">
  144. <div align="center">
  145. <img src="assets/SG_img/SG - Horizontal Glow 2.png" width="600"/>
  146. <br/><br/>
  147. <p><strong>Build, train, and fine-tune production-ready deep learning SOTA vision models</strong>
  148. <a class="reference external" href="https://twitter.com/intent/tweet?text=Easily%20train%20or%20fine-tune%20SOTA%20computer%20vision%20models%20from%20one%20training%20repository&amp;url=https://github.com/Deci-AI/super-gradients&amp;via=deci_ai&amp;hashtags=AI,deeplearning,computervision,training,opensource"><img alt="Tweet" src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" /></a></p>
  149. <div class="section" id="version-3-is-out-notebooks-have-been-updated">
  150. <h1>Version 3 is out! Notebooks have been updated!<a class="headerlink" href="#version-3-is-out-notebooks-have-been-updated" title="Permalink to this heading"></a></h1>
  151. <hr class="docutils" />
  152. <p align="center">
  153. <a href="https://www.supergradients.com/">Website</a> •
  154. <a href="#getting-started">Getting Started</a> •
  155. <a href="#implemented-model-architectures">Pretrained Models</a> •
  156. <a href="#community">Community</a> •
  157. <a href="#license">License</a> •
  158. <a href="#deci-platform">Deci Platform</a>
  159. </p>
  160. <p align="center">
  161. <a href="https://github.com/Deci-AI/super-gradients#prerequisites"><img src="https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9-blue" />
  162. <a href="https://github.com/Deci-AI/super-gradients#prerequisites"><img src="https://img.shields.io/badge/pytorch-1.9%20%7C%201.10-blue" />
  163. <a href="https://pypi.org/project/super-gradients/"><img src="https://img.shields.io/pypi/v/super-gradients" />
  164. <a href="https://github.com/Deci-AI/super-gradients#computer-vision-models-pretrained-checkpoints" ><img src="https://img.shields.io/badge/pre--trained%20models-34-brightgreen" />
  165. <a href="https://github.com/Deci-AI/super-gradients/releases"><img src="https://img.shields.io/github/v/release/Deci-AI/super-gradients" />
  166. <a href="https://join.slack.com/t/supergradients-comm52/shared_invite/zt-10vz6o1ia-b_0W5jEPEnuHXm087K~t8Q"><img src="https://img.shields.io/badge/slack-community-blueviolet" />
  167. <a href="https://github.com/Deci-AI/super-gradients/blob/master/LICENSE.md"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" />
  168. <a href="https://deci-ai.github.io/super-gradients/welcome.html"><img src="https://img.shields.io/badge/docs-sphinx-brightgreen" />
  169. </p>
  170. </div>
  171. </div>
  172. <div class="section" id="build-with-supergradients">
  173. <h1>Build with SuperGradients<a class="headerlink" href="#build-with-supergradients" title="Permalink to this heading"></a></h1>
  174. <hr class="docutils" />
  175. <div class="section" id="support-various-computer-vision-tasks">
  176. <h2>Support various computer vision tasks<a class="headerlink" href="#support-various-computer-vision-tasks" title="Permalink to this heading"></a></h2>
  177. <div align="center">
  178. <img src="./assets/SG_img/Segmentation 1500x900 .png" width="250px">
  179. <img src="./assets/SG_img/Object detection 1500X900.png" width="250px">
  180. <img src="./assets/SG_img/Classification 1500x900.png" width="250px">
  181. </div>
  182. </div>
  183. <div class="section" id="ready-to-deploy-pre-trained-sota-models">
  184. <h2>Ready to deploy pre-trained SOTA models<a class="headerlink" href="#ready-to-deploy-pre-trained-sota-models" title="Permalink to this heading"></a></h2>
  185. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Load model with pretrained weights</span>
  186. <span class="n">model</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;yolox_s&quot;</span><span class="p">,</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;coco&quot;</span><span class="p">)</span>
  187. </pre></div>
  188. </div>
  189. <div class="section" id="all-computer-vision-models-pretrained-checkpoints-can-be-found-in-the-model-zoo">
  190. <h3>All Computer Vision Models - Pretrained Checkpoints can be found in the <a class="reference external" href="http://bit.ly/3EGfKD4">Model Zoo</a><a class="headerlink" href="#all-computer-vision-models-pretrained-checkpoints-can-be-found-in-the-model-zoo" title="Permalink to this heading"></a></h3>
  191. </div>
  192. <div class="section" id="classification">
  193. <h3>Classification<a class="headerlink" href="#classification" title="Permalink to this heading"></a></h3>
  194. <div align="center">
  195. <img src="./assets/SG_img/Classification@2xDark.png" width="800px">
  196. </div>
  197. </div>
  198. <div class="section" id="semantic-segmentation">
  199. <h3>Semantic Segmentation<a class="headerlink" href="#semantic-segmentation" title="Permalink to this heading"></a></h3>
  200. <div align="center">
  201. <img src="./assets/SG_img/Semantic Segmentation@2xDark.png" width="800px">
  202. </div>
  203. </div>
  204. <div class="section" id="object-detection">
  205. <h3>Object Detection<a class="headerlink" href="#object-detection" title="Permalink to this heading"></a></h3>
  206. <div align="center">
  207. <img src="./assets/SG_img/Object Detection@2xDark.png" width="800px">
  208. </div>
  209. </div>
  210. </div>
  211. <div class="section" id="easy-to-train-sota-models">
  212. <h2>Easy to train SOTA Models<a class="headerlink" href="#easy-to-train-sota-models" title="Permalink to this heading"></a></h2>
  213. <p>Easily load and fine-tune production-ready, pre-trained SOTA models that incorporate best practices and validated hyper-parameters for achieving best-in-class accuracy.
  214. For more information on how to do it go to <span class="xref myst">Getting Started</span></p>
  215. <div class="section" id="plug-and-play-recipes">
  216. <h3>Plug and play recipes<a class="headerlink" href="#plug-and-play-recipes" title="Permalink to this heading"></a></h3>
  217. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">super_gradients</span><span class="o">.</span><span class="n">examples</span><span class="o">.</span><span class="n">train_from_recipe_example</span><span class="o">.</span><span class="n">train_from_recipe</span> <span class="n">architecture</span><span class="o">=</span><span class="n">regnetY800</span> <span class="n">dataset_interface</span><span class="o">.</span><span class="n">data_dir</span><span class="o">=&lt;</span><span class="n">YOUR_Imagenet_LOCAL_PATH</span><span class="o">&gt;</span> <span class="n">ckpt_root_dir</span><span class="o">=&lt;</span><span class="n">CHEKPOINT_DIRECTORY</span><span class="o">&gt;</span>
  218. </pre></div>
  219. </div>
  220. <p>More example on how and why to use recipes can be found in <span class="xref myst">Recipes</span></p>
  221. </div>
  222. </div>
  223. <div class="section" id="production-readiness">
  224. <h2>Production readiness<a class="headerlink" href="#production-readiness" title="Permalink to this heading"></a></h2>
  225. <p>All SuperGradients models’ are production ready in the sense that they are compatible with deployment tools such as TensorRT (Nvidia) and OpenVINO (Intel) and can be easily taken into production. With a few lines of code you can easily integrate the models into your codebase.</p>
  226. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Load model with pretrained weights</span>
  227. <span class="n">model</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;yolox_s&quot;</span><span class="p">,</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;coco&quot;</span><span class="p">)</span>
  228. <span class="c1"># Prepare model for conversion</span>
  229. <span class="c1"># Input size is in format of [Batch x Channels x Width x Height] where 640 is the standart COCO dataset dimensions</span>
  230. <span class="n">model</span><span class="o">.</span><span class="n">eval</span><span class="p">()</span>
  231. <span class="n">model</span><span class="o">.</span><span class="n">prep_model_for_conversion</span><span class="p">(</span><span class="n">input_size</span><span class="o">=</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">640</span><span class="p">,</span> <span class="mi">640</span><span class="p">])</span>
  232. <span class="c1"># Create dummy_input</span>
  233. <span class="c1"># Convert model to onnx</span>
  234. <span class="n">torch</span><span class="o">.</span><span class="n">onnx</span><span class="o">.</span><span class="n">export</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">dummy_input</span><span class="p">,</span> <span class="s2">&quot;yolox_s.onnx&quot;</span><span class="p">)</span>
  235. </pre></div>
  236. </div>
  237. <p>More information on how to take your model to production can be found in <span class="xref myst">Getting Started</span> notebooks</p>
  238. </div>
  239. </div>
  240. <div class="section" id="quick-installation">
  241. <h1>Quick Installation<a class="headerlink" href="#quick-installation" title="Permalink to this heading"></a></h1>
  242. <hr class="docutils" />
  243. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install super-gradients
  244. </pre></div>
  245. </div>
  246. </div>
  247. <div class="section" id="what-s-new">
  248. <h1>What’s New<a class="headerlink" href="#what-s-new" title="Permalink to this heading"></a></h1>
  249. <hr class="docutils" />
  250. <ul class="simple">
  251. <li><p>【17/11/2022】 Integration with ClearML</p></li>
  252. <li><p>【06/9/2022】 PP-LiteSeg - new pre-trained <a class="reference external" href="http://bit.ly/3EGfKD4">checkpoints</a> and <a class="reference external" href="http://bit.ly/3gfLw07">recipes</a> for Cityscapes with SOTA mIoU scores (~1.5% above paper)🎯</p></li>
  253. <li><p>【07/08/2022】DDRNet23 - new pre-trained <a class="reference external" href="http://bit.ly/3EGfKD4">checkpoints</a> and <a class="reference external" href="http://bit.ly/3gfLw07">recipes</a> for Cityscapes with SOTA mIoU scores (~1% above paper)🎯</p></li>
  254. <li><p>【27/07/2022】YOLOX models (object detection) - recipes and pre-trained checkpoints.</p></li>
  255. <li><p>【07/07/2022】SSD Lite MobileNet V2,V1 - Training <a class="reference external" href="http://bit.ly/3gfLw07">recipes</a> and pre-trained <a class="reference external" href="http://bit.ly/3EGfKD4">checkpoints</a> on COCO - Tailored for edge devices! 📱</p></li>
  256. <li><p>【07/07/2022】 STDC - new pre-trained <a class="reference external" href="http://bit.ly/3EGfKD4">checkpoints</a> and <a class="reference external" href="http://bit.ly/3gfLw07">recipes</a> for Cityscapes with super SOTA mIoU scores (~2.5% above paper)🎯</p></li>
  257. </ul>
  258. <p>Check out SG full <a class="reference external" href="https://github.com/Deci-AI/super-gradients/releases">release notes</a>.</p>
  259. </div>
  260. <div class="section" id="coming-soon">
  261. <h1>Coming soon<a class="headerlink" href="#coming-soon" title="Permalink to this heading"></a></h1>
  262. <hr class="docutils" />
  263. <ul class="simple">
  264. <li><p>[ ] PP-Yolo-E implementation</p></li>
  265. <li><p>[ ] Quantization aware training (QAT)</p></li>
  266. <li><p>[ ] Tools for faster training</p></li>
  267. <li><p>[ ] Integration with more professional tools.</p></li>
  268. </ul>
  269. </div>
  270. <div class="section" id="table-of-content">
  271. <h1>Table of Content<a class="headerlink" href="#table-of-content" title="Permalink to this heading"></a></h1>
  272. <hr class="docutils" />
  273. <!-- toc -->
  274. <ul class="simple">
  275. <li><p><span class="xref myst">Getting Started</span></p></li>
  276. <li><p><span class="xref myst">Advanced Features</span></p></li>
  277. <li><p><span class="xref myst">Installation Methods</span></p>
  278. <ul>
  279. <li><p><span class="xref myst">Prerequisites</span></p></li>
  280. <li><p><span class="xref myst">Quick Installation</span></p></li>
  281. </ul>
  282. </li>
  283. <li><p><span class="xref myst">Implemented Model Architectures</span></p></li>
  284. <li><p><span class="xref myst">Contributing</span></p></li>
  285. <li><p><span class="xref myst">Citation</span></p></li>
  286. <li><p><span class="xref myst">Community</span></p></li>
  287. <li><p><span class="xref myst">License</span></p></li>
  288. <li><p><span class="xref myst">Deci Platform</span></p></li>
  289. </ul>
  290. <!-- tocstop -->
  291. </div>
  292. <div class="section" id="getting-started">
  293. <h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this heading"></a></h1>
  294. <hr class="docutils" />
  295. <div class="section" id="start-training-with-just-1-command-line">
  296. <h2>Start Training with Just 1 Command Line<a class="headerlink" href="#start-training-with-just-1-command-line" title="Permalink to this heading"></a></h2>
  297. <p>The most simple and straightforward way to start training SOTA performance models with SuperGradients reproducible recipes. Just define your dataset path and where you want your checkpoints to be saved and you are good to go from your terminal!</p>
  298. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python -m super_gradients.examples.train_from_recipe_example.train_from_recipe --config-name<span class="o">=</span>imagenet_regnetY <span class="nv">architecture</span><span class="o">=</span>regnetY800 dataset_interface.data_dir<span class="o">=</span>&lt;YOUR_Imagenet_LOCAL_PATH&gt; <span class="nv">ckpt_root_dir</span><span class="o">=</span>&lt;CHEKPOINT_DIRECTORY&gt;
  299. </pre></div>
  300. </div>
  301. </div>
  302. <div class="section" id="quickly-load-pre-trained-weights-for-your-desired-model-with-sota-performance">
  303. <h2>Quickly Load Pre-Trained Weights for Your Desired Model with SOTA Performance<a class="headerlink" href="#quickly-load-pre-trained-weights-for-your-desired-model-with-sota-performance" title="Permalink to this heading"></a></h2>
  304. <p>Want to try our pre-trained models on your machine? Import SuperGradients, initialize your Trainer, and load your desired architecture and pre-trained weights from our <a class="reference external" href="http://bit.ly/3EGfKD4">SOTA model zoo</a></p>
  305. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># The pretrained_weights argument will load a pre-trained architecture on the provided dataset</span>
  306. <span class="kn">import</span> <span class="nn">super_gradients</span>
  307. <span class="n">model</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;model-name&quot;</span><span class="p">,</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;pretrained-model-name&quot;</span><span class="p">)</span>
  308. </pre></div>
  309. </div>
  310. </div>
  311. <div class="section" id="id1">
  312. <h2>Classification<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
  313. <div class="section" id="transfer-learning">
  314. <h3>Transfer Learning<a class="headerlink" href="#transfer-learning" title="Permalink to this heading"></a></h3>
  315. <table class="tfo-notebook-buttons" align="left">
  316. <td width="500">
  317. <a target="_blank" href="https://bit.ly/3xzIutb"><img src="./assets/SG_img/colab_logo.png" /> Classification Transfer Learning</a>
  318. </td>
  319. <td width="200">
  320. <a target="_blank" href="https://bit.ly/3xwYEn1"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  321. </td>
  322. </table>
  323. </br></br>
  324. </div>
  325. </div>
  326. <div class="section" id="id2">
  327. <h2>Semantic Segmentation<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
  328. <div class="section" id="quick-start">
  329. <h3>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to this heading"></a></h3>
  330. <table class="tfo-notebook-buttons" align="left">
  331. <td width="500">
  332. <a target="_blank" href="https://bit.ly/3qKx9m8"><img src="./assets/SG_img/colab_logo.png" /> Segmentation Quick Start</a>
  333. </td>
  334. <td width="200">
  335. <a target="_blank" href="https://bit.ly/3qJjxYq"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source </a>
  336. </td>
  337. </table>
  338. </br></br>
  339. </div>
  340. <div class="section" id="id3">
  341. <h3>Transfer Learning<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h3>
  342. <table class="tfo-notebook-buttons" align="left">
  343. <td width="500">
  344. <a target="_blank" href="https://bit.ly/3qKwMbe"><img src="./assets/SG_img/colab_logo.png" /> Segmentation Transfer Learning</a>
  345. </td>
  346. <td width="200">
  347. <a target="_blank" href="https://bit.ly/3ShJlXn"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  348. </td>
  349. </table>
  350. </br></br>
  351. </div>
  352. <div class="section" id="how-to-connect-custom-dataset">
  353. <h3>How to Connect Custom Dataset<a class="headerlink" href="#how-to-connect-custom-dataset" title="Permalink to this heading"></a></h3>
  354. <table class="tfo-notebook-buttons" align="left">
  355. <td width="500">
  356. <a target="_blank" href="https://bit.ly/3QQBVJp"><img src="./assets/SG_img/colab_logo.png" /> Segmentation How to Connect Custom Dataset</a>
  357. </td>
  358. <td width="200">
  359. <a target="_blank" href="https://bit.ly/3Us2WGi"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  360. </td>
  361. </table>
  362. </br></br>
  363. </div>
  364. </div>
  365. <div class="section" id="id4">
  366. <h2>Object Detection<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
  367. <div class="section" id="id5">
  368. <h3>Transfer Learning<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
  369. <table class="tfo-notebook-buttons" align="left">
  370. <td width="500">
  371. <a target="_blank" href="https://bit.ly/3SkMohx"><img src="./assets/SG_img/colab_logo.png" /> Detection Transfer Learning</a>
  372. </td>
  373. <td width="200">
  374. <a target="_blank" href="https://bit.ly/3DF8siG"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  375. </td>
  376. </table>
  377. </br></br>
  378. </div>
  379. <div class="section" id="id6">
  380. <h3>How to Connect Custom Dataset<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
  381. <table class="tfo-notebook-buttons" align="left">
  382. <td width="500">
  383. <a target="_blank" href="https://bit.ly/3dqDlg3"><img src="./assets/SG_img/colab_logo.png" /> Detection How to Connect Custom Dataset</a>
  384. </td>
  385. <td width="200">
  386. <a target="_blank" href="https://bit.ly/3xBlcmq"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  387. </td>
  388. </table>
  389. </br></br>
  390. </div>
  391. </div>
  392. <div class="section" id="how-to-predict-using-pre-trained-model">
  393. <h2>How to Predict Using Pre-trained Model<a class="headerlink" href="#how-to-predict-using-pre-trained-model" title="Permalink to this heading"></a></h2>
  394. <div class="section" id="segmentation-detection-and-classification-prediction">
  395. <h3>Segmentation, Detection and Classification Prediction<a class="headerlink" href="#segmentation-detection-and-classification-prediction" title="Permalink to this heading"></a></h3>
  396. <table class="tfo-notebook-buttons" align="left">
  397. <td width="500">
  398. <a target="_blank" href="https://bit.ly/3f4mssd"><img src="./assets/SG_img/colab_logo.png" /> How to Predict Using Pre-trained Model</a>
  399. </td>
  400. <td width="200">
  401. <a target="_blank" href="https://bit.ly/3Sf59Tr"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  402. </td>
  403. </table>
  404. </br></br>
  405. </div>
  406. </div>
  407. </div>
  408. <div class="section" id="advanced-features">
  409. <h1>Advanced Features<a class="headerlink" href="#advanced-features" title="Permalink to this heading"></a></h1>
  410. <hr class="docutils" />
  411. <div class="section" id="knowledge-distillation-training">
  412. <h2>Knowledge Distillation Training<a class="headerlink" href="#knowledge-distillation-training" title="Permalink to this heading"></a></h2>
  413. <p>Knowledge Distillation is a training technique that uses a large model, teacher model, to improve the performance of a smaller model, the student model.
  414. Learn more about SuperGradients knowledge distillation training with our pre-trained BEiT base teacher model and Resnet18 student model on CIFAR10 example notebook on Google Colab for an easy to use tutorial using free GPU hardware</p>
  415. <table class="tfo-notebook-buttons" align="left">
  416. <td width="500">
  417. <a target="_blank" href="https://bit.ly/3BLA5oR"><img src="./assets/SG_img/colab_logo.png" /> Knowledge Distillation Training</a>
  418. </td>
  419. <td width="200">
  420. <a target="_blank" href="https://bit.ly/3S9UlG4"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  421. </td>
  422. </table>
  423. </br></br>
  424. </div>
  425. <div class="section" id="recipes">
  426. <h2>Recipes<a class="headerlink" href="#recipes" title="Permalink to this heading"></a></h2>
  427. <p>To train a model, it is necessary to configure 4 main components. These components are aggregated into a single “main” recipe <code class="docutils literal notranslate"><span class="pre">.yaml</span></code> file that inherits the aforementioned dataset, architecture, raining and checkpoint params. It is also possible (and recomended for flexibility) to override default settings with custom ones.
  428. All recipes can be found <a class="reference external" href="http://bit.ly/3gfLw07">here</a>
  429. </br>
  430. Recipes support out of the box every model, metric or loss that is implemented in SuperGradients, but you can easily extend this to any custom object that you need by “registering it”. Check out <a class="reference external" href="http://bit.ly/3TQ4iZB">this</a> tutorial for more information.</p>
  431. <table class="tfo-notebook-buttons" align="left">
  432. <td width="500">
  433. <a target="_blank" href="https://bit.ly/3UiY5ab"><img src="./assets/SG_img/colab_logo.png" /> How to Use Recipes</a>
  434. </td>
  435. <td width="200">
  436. <a target="_blank" href="https://bit.ly/3QSrHbm"><img src="./assets/SG_img/GitHub_logo.png" /> GitHub source</a>
  437. </td>
  438. </table>
  439. </br></br>
  440. </br>
  441. <details>
  442. <summary><h3>Using Distributed Data Parallel (DDP) </h3></summary>
  443. <div class="section" id="why-use-ddp">
  444. <h3>Why use DDP ?<a class="headerlink" href="#why-use-ddp" title="Permalink to this heading"></a></h3>
  445. <p>Recent Deep Learning models are growing larger and larger to an extent that training on a single GPU can take weeks.
  446. In order to train models in a timely fashion, it is necessary to train them with multiple GPUs.
  447. Using 100s GPUs can reduce training time of a model from a week to less than an hour.</p>
  448. </div>
  449. <div class="section" id="how-does-it-work">
  450. <h3>How does it work ?<a class="headerlink" href="#how-does-it-work" title="Permalink to this heading"></a></h3>
  451. <p>Each GPU has its own process, which controls a copy of the model and which loads its own mini-batch from disk and sends
  452. it to its GPU during training. After the forward pass is completed on every GPU, the gradient is reduced across all
  453. GPUs, yielding to all the GPUs having the same gradient locally. This leads to the model weights to stay synchronized
  454. across all GPUs after the backward pass.</p>
  455. </div>
  456. <div class="section" id="how-to-use-it">
  457. <h3>How to use it ?<a class="headerlink" href="#how-to-use-it" title="Permalink to this heading"></a></h3>
  458. <p>You can use SuperGradients to train your model with DDP in just a few lines.</p>
  459. <p><em>main.py</em></p>
  460. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients</span> <span class="kn">import</span> <span class="n">init_trainer</span><span class="p">,</span> <span class="n">Trainer</span>
  461. <span class="kn">from</span> <span class="nn">super_gradients.common</span> <span class="kn">import</span> <span class="n">MultiGPUMode</span>
  462. <span class="kn">from</span> <span class="nn">super_gradients.training.utils.distributed_training_utils</span> <span class="kn">import</span> <span class="n">setup_device</span>
  463. <span class="c1"># Initialize the environment</span>
  464. <span class="n">init_trainer</span><span class="p">()</span>
  465. <span class="c1"># Launch DDP on 4 GPUs&#39;</span>
  466. <span class="n">setup_device</span><span class="p">(</span><span class="n">multi_gpu</span><span class="o">=</span><span class="n">MultiGPUMode</span><span class="o">.</span><span class="n">DISTRIBUTED_DATA_PARALLEL</span><span class="p">,</span> <span class="n">num_gpus</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span>
  467. <span class="c1"># Call the trainer</span>
  468. <span class="n">Trainer</span><span class="p">(</span><span class="n">multi_gpu</span><span class="o">=</span><span class="n">MultiGPUMode</span><span class="o">.</span><span class="n">DISTRIBUTED_DATA_PARALLEL</span><span class="p">,</span> <span class="n">expriment_name</span><span class="o">=...</span><span class="p">)</span>
  469. <span class="c1"># Everything you do below will run on 4 gpus</span>
  470. <span class="o">...</span>
  471. <span class="n">Trainer</span><span class="o">.</span><span class="n">train</span><span class="p">(</span><span class="o">...</span><span class="p">)</span>
  472. </pre></div>
  473. </div>
  474. <p>Finally, you can launch your distributed training with a simple python call.</p>
  475. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python main.py
  476. </pre></div>
  477. </div>
  478. <p>Please note that if you work with <code class="docutils literal notranslate"><span class="pre">torch&lt;1.9.0</span></code> (deprecated), you will have to launch your training with either
  479. <code class="docutils literal notranslate"><span class="pre">torch.distributed.launch</span></code> or <code class="docutils literal notranslate"><span class="pre">torchrun</span></code>, in which case <code class="docutils literal notranslate"><span class="pre">nproc_per_node</span></code> will overwrite the value set with <code class="docutils literal notranslate"><span class="pre">gpu_mode</span></code>:</p>
  480. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python -m torch.distributed.launch --nproc_per_node<span class="o">=</span><span class="m">4</span> main.py
  481. </pre></div>
  482. </div>
  483. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>torchrun --nproc_per_node<span class="o">=</span><span class="m">4</span> main.py
  484. </pre></div>
  485. </div>
  486. </div>
  487. <div class="section" id="calling-functions-on-a-single-node">
  488. <h3>Calling functions on a single node<a class="headerlink" href="#calling-functions-on-a-single-node" title="Permalink to this heading"></a></h3>
  489. <p>It is often in DDP training that we want to execute code on the master rank (i.e rank 0).
  490. In SG, users usually execute their own code by triggering “Phase Callbacks” (see “Using phase callbacks” section below).
  491. One can make sure the desired code will only be ran on rank 0, using ddp_silent_mode or the multi_process_safe decorator.
  492. For example, consider the simple phase callback below, that uploads the first 3 images of every batch during training to
  493. the Tensorboard:</p>
  494. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients.training.utils.callbacks</span> <span class="kn">import</span> <span class="n">PhaseCallback</span><span class="p">,</span> <span class="n">PhaseContext</span><span class="p">,</span> <span class="n">Phase</span>
  495. <span class="kn">from</span> <span class="nn">super_gradients.common.environment.env_helpers</span> <span class="kn">import</span> <span class="n">multi_process_safe</span>
  496. <span class="k">class</span> <span class="nc">Upload3TrainImagesCalbback</span><span class="p">(</span><span class="n">PhaseCallback</span><span class="p">):</span>
  497. <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span>
  498. <span class="bp">self</span><span class="p">,</span>
  499. <span class="p">):</span>
  500. <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">phase</span><span class="o">=</span><span class="n">Phase</span><span class="o">.</span><span class="n">TRAIN_BATCH_END</span><span class="p">)</span>
  501. <span class="nd">@multi_process_safe</span>
  502. <span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">context</span><span class="p">:</span> <span class="n">PhaseContext</span><span class="p">):</span>
  503. <span class="n">batch_imgs</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span>
  504. <span class="n">tag</span> <span class="o">=</span> <span class="s2">&quot;batch_&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">batch_idx</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;_images&quot;</span>
  505. <span class="n">context</span><span class="o">.</span><span class="n">sg_logger</span><span class="o">.</span><span class="n">add_images</span><span class="p">(</span><span class="n">tag</span><span class="o">=</span><span class="n">tag</span><span class="p">,</span> <span class="n">images</span><span class="o">=</span><span class="n">batch_imgs</span><span class="p">[:</span> <span class="mi">3</span><span class="p">],</span> <span class="n">global_step</span><span class="o">=</span><span class="n">context</span><span class="o">.</span><span class="n">epoch</span><span class="p">)</span>
  506. </pre></div>
  507. </div>
  508. <p>The &#64;multi_process_safe decorator ensures that the callback will only be triggered by rank 0. Alternatively, this can also
  509. be done by the SG trainer boolean attribute (which the phase context has access to), ddp_silent_mode, which is set to False
  510. iff the current process rank is zero (even after the process group has been killed):</p>
  511. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients.training.utils.callbacks</span> <span class="kn">import</span> <span class="n">PhaseCallback</span><span class="p">,</span> <span class="n">PhaseContext</span><span class="p">,</span> <span class="n">Phase</span>
  512. <span class="k">class</span> <span class="nc">Upload3TrainImagesCalbback</span><span class="p">(</span><span class="n">PhaseCallback</span><span class="p">):</span>
  513. <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span>
  514. <span class="bp">self</span><span class="p">,</span>
  515. <span class="p">):</span>
  516. <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">phase</span><span class="o">=</span><span class="n">Phase</span><span class="o">.</span><span class="n">TRAIN_BATCH_END</span><span class="p">)</span>
  517. <span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">context</span><span class="p">:</span> <span class="n">PhaseContext</span><span class="p">):</span>
  518. <span class="k">if</span> <span class="ow">not</span> <span class="n">context</span><span class="o">.</span><span class="n">ddp_silent_mode</span><span class="p">:</span>
  519. <span class="n">batch_imgs</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">cpu</span><span class="p">()</span><span class="o">.</span><span class="n">detach</span><span class="p">()</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span>
  520. <span class="n">tag</span> <span class="o">=</span> <span class="s2">&quot;batch_&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">batch_idx</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;_images&quot;</span>
  521. <span class="n">context</span><span class="o">.</span><span class="n">sg_logger</span><span class="o">.</span><span class="n">add_images</span><span class="p">(</span><span class="n">tag</span><span class="o">=</span><span class="n">tag</span><span class="p">,</span> <span class="n">images</span><span class="o">=</span><span class="n">batch_imgs</span><span class="p">[:</span> <span class="mi">3</span><span class="p">],</span> <span class="n">global_step</span><span class="o">=</span><span class="n">context</span><span class="o">.</span><span class="n">epoch</span><span class="p">)</span>
  522. </pre></div>
  523. </div>
  524. <p>Note that ddp_silent_mode can be accessed through SgTrainer.ddp_silent_mode. Hence, it can be used in scripts after calling
  525. SgTrainer.train() when some part of it should be ran on rank 0 only.</p>
  526. </div>
  527. <div class="section" id="good-to-know">
  528. <h3>Good to know<a class="headerlink" href="#good-to-know" title="Permalink to this heading"></a></h3>
  529. <p>Your total batch size will be (number of gpus x batch size), so you might want to increase your learning rate.
  530. There is no clear rule, but a rule of thumb seems to be to <a class="reference external" href="https://arxiv.org/pdf/1706.02677.pdf">linearly increase the learning rate with the number of gpus</a></p>
  531. </details>
  532. <details>
  533. <summary><h3> Easily change architectures parameters </h3></summary>
  534. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients.training</span> <span class="kn">import</span> <span class="n">models</span>
  535. <span class="c1"># instantiate default pretrained resnet18</span>
  536. <span class="n">default_resnet18</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">model_name</span><span class="o">=</span><span class="s2">&quot;resnet18&quot;</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;imagenet&quot;</span><span class="p">)</span>
  537. <span class="c1"># instantiate pretrained resnet18, turning DropPath on with probability 0.5</span>
  538. <span class="n">droppath_resnet18</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">model_name</span><span class="o">=</span><span class="s2">&quot;resnet18&quot;</span><span class="p">,</span> <span class="n">arch_params</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;droppath_prob&quot;</span><span class="p">:</span> <span class="mf">0.5</span><span class="p">},</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;imagenet&quot;</span><span class="p">)</span>
  539. <span class="c1"># instantiate pretrained resnet18, without classifier head. Output will be from the last stage before global pooling</span>
  540. <span class="n">backbone_resnet18</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">model_name</span><span class="o">=</span><span class="s2">&quot;resnet18&quot;</span><span class="p">,</span> <span class="n">arch_params</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;backbone_mode&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">},</span> <span class="n">pretrained_weights</span><span class="o">=</span><span class="s2">&quot;imagenet&quot;</span><span class="p">)</span>
  541. </pre></div>
  542. </div>
  543. </details>
  544. <details>
  545. <summary><h3> Using phase callbacks </h3></summary>
  546. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients</span> <span class="kn">import</span> <span class="n">Trainer</span>
  547. <span class="kn">from</span> <span class="nn">torch.optim.lr_scheduler</span> <span class="kn">import</span> <span class="n">ReduceLROnPlateau</span>
  548. <span class="kn">from</span> <span class="nn">super_gradients.training.utils.callbacks</span> <span class="kn">import</span> <span class="n">Phase</span><span class="p">,</span> <span class="n">LRSchedulerCallback</span>
  549. <span class="kn">from</span> <span class="nn">super_gradients.training.metrics.classification_metrics</span> <span class="kn">import</span> <span class="n">Accuracy</span>
  550. <span class="c1"># define PyTorch train and validation loaders and optimizer</span>
  551. <span class="c1"># define what to be called in the callback</span>
  552. <span class="n">rop_lr_scheduler</span> <span class="o">=</span> <span class="n">ReduceLROnPlateau</span><span class="p">(</span><span class="n">optimizer</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;max&quot;</span><span class="p">,</span> <span class="n">patience</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">verbose</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
  553. <span class="c1"># define phase callbacks, they will fire as defined in Phase</span>
  554. <span class="n">phase_callbacks</span> <span class="o">=</span> <span class="p">[</span><span class="n">LRSchedulerCallback</span><span class="p">(</span><span class="n">scheduler</span><span class="o">=</span><span class="n">rop_lr_scheduler</span><span class="p">,</span>
  555. <span class="n">phase</span><span class="o">=</span><span class="n">Phase</span><span class="o">.</span><span class="n">VALIDATION_EPOCH_END</span><span class="p">,</span>
  556. <span class="n">metric_name</span><span class="o">=</span><span class="s2">&quot;Accuracy&quot;</span><span class="p">)]</span>
  557. <span class="c1"># create a trainer object, look the declaration for more parameters</span>
  558. <span class="n">trainer</span> <span class="o">=</span> <span class="n">Trainer</span><span class="p">(</span><span class="s2">&quot;experiment_name&quot;</span><span class="p">)</span>
  559. <span class="c1"># define phase_callbacks as part of the training parameters</span>
  560. <span class="n">train_params</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;phase_callbacks&quot;</span><span class="p">:</span> <span class="n">phase_callbacks</span><span class="p">}</span>
  561. </pre></div>
  562. </div>
  563. </details>
  564. <details>
  565. <summary><h3> Integration to Weights and Biases </h3></summary>
  566. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients</span> <span class="kn">import</span> <span class="n">Trainer</span>
  567. <span class="c1"># create a trainer object, look the declaration for more parameters</span>
  568. <span class="n">trainer</span> <span class="o">=</span> <span class="n">Trainer</span><span class="p">(</span><span class="s2">&quot;experiment_name&quot;</span><span class="p">)</span>
  569. <span class="n">train_params</span> <span class="o">=</span> <span class="p">{</span> <span class="o">...</span> <span class="c1"># training parameters</span>
  570. <span class="s2">&quot;sg_logger&quot;</span><span class="p">:</span> <span class="s2">&quot;wandb_sg_logger&quot;</span><span class="p">,</span> <span class="c1"># Weights&amp;Biases Logger, see class WandBSGLogger for details</span>
  571. <span class="s2">&quot;sg_logger_params&quot;</span><span class="p">:</span> <span class="c1"># paramenters that will be passes to __init__ of the logger </span>
  572. <span class="p">{</span>
  573. <span class="s2">&quot;project_name&quot;</span><span class="p">:</span> <span class="s2">&quot;project_name&quot;</span><span class="p">,</span> <span class="c1"># W&amp;B project name</span>
  574. <span class="s2">&quot;save_checkpoints_remote&quot;</span><span class="p">:</span> <span class="kc">True</span>
  575. <span class="s2">&quot;save_tensorboard_remote&quot;</span><span class="p">:</span> <span class="kc">True</span>
  576. <span class="s2">&quot;save_logs_remote&quot;</span><span class="p">:</span> <span class="kc">True</span>
  577. <span class="p">}</span>
  578. <span class="p">}</span>
  579. </pre></div>
  580. </div>
  581. </details>
  582. <details>
  583. <summary><h3> Integration to ClearML </h3></summary>
  584. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">super_gradients</span> <span class="kn">import</span> <span class="n">Trainer</span>
  585. <span class="c1"># create a trainer object, look the declaration for more parameters</span>
  586. <span class="n">trainer</span> <span class="o">=</span> <span class="n">Trainer</span><span class="p">(</span><span class="s2">&quot;experiment_name&quot;</span><span class="p">)</span>
  587. <span class="n">train_params</span> <span class="o">=</span> <span class="p">{</span> <span class="o">...</span> <span class="c1"># training parameters</span>
  588. <span class="s2">&quot;sg_logger&quot;</span><span class="p">:</span> <span class="s2">&quot;clearml_sg_logger&quot;</span><span class="p">,</span> <span class="c1"># ClearML Logger, see class ClearMLSGLogger for details</span>
  589. <span class="s2">&quot;sg_logger_params&quot;</span><span class="p">:</span> <span class="c1"># paramenters that will be passes to __init__ of the logger </span>
  590. <span class="p">{</span>
  591. <span class="s2">&quot;project_name&quot;</span><span class="p">:</span> <span class="s2">&quot;project_name&quot;</span><span class="p">,</span> <span class="c1"># ClearML project name</span>
  592. <span class="s2">&quot;save_checkpoints_remote&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
  593. <span class="s2">&quot;save_tensorboard_remote&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
  594. <span class="s2">&quot;save_logs_remote&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
  595. <span class="p">}</span>
  596. <span class="p">}</span>
  597. </pre></div>
  598. </div>
  599. </details>
  600. </div>
  601. </div>
  602. </div>
  603. <div class="section" id="installation-methods">
  604. <h1>Installation Methods<a class="headerlink" href="#installation-methods" title="Permalink to this heading"></a></h1>
  605. <hr class="docutils" />
  606. <div class="section" id="prerequisites">
  607. <h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this heading"></a></h2>
  608. <details>
  609. <summary>General requirements</summary>
  610. <ul class="simple">
  611. <li><p>Python 3.7, 3.8 or 3.9 installed.</p></li>
  612. <li><p>torch&gt;=1.9.0</p>
  613. <ul>
  614. <li><p>https://pytorch.org/get-started/locally/</p></li>
  615. </ul>
  616. </li>
  617. <li><p>The python packages that are specified in requirements.txt;</p></li>
  618. </ul>
  619. </details>
  620. <details>
  621. <summary>To train on nvidia GPUs</summary>
  622. <ul class="simple">
  623. <li><p><a class="reference external" href="https://developer.nvidia.com/cuda-11.2.0-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;target_distro=Ubuntu">Nvidia CUDA Toolkit &gt;= 11.2</a></p></li>
  624. <li><p>CuDNN &gt;= 8.1.x</p></li>
  625. <li><p>Nvidia Driver with CUDA &gt;= 11.2 support (≥460.x)</p></li>
  626. </ul>
  627. </details>
  628. </div>
  629. <div class="section" id="id7">
  630. <h2>Quick Installation<a class="headerlink" href="#id7" title="Permalink to this heading"></a></h2>
  631. <details>
  632. <summary>Install stable version using PyPi</summary>
  633. <p>See in <a class="reference external" href="https://pypi.org/project/super-gradients/">PyPi</a></p>
  634. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install super-gradients
  635. </pre></div>
  636. </div>
  637. <p>That’s it !</p>
  638. </details>
  639. <details>
  640. <summary>Install using GitHub</summary>
  641. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install git+https://github.com/Deci-AI/super-gradients.git@stable
  642. </pre></div>
  643. </div>
  644. </details>
  645. </div>
  646. </div>
  647. <div class="section" id="implemented-model-architectures">
  648. <h1>Implemented Model Architectures<a class="headerlink" href="#implemented-model-architectures" title="Permalink to this heading"></a></h1>
  649. <hr class="docutils" />
  650. <p>All Computer Vision Models - Pretrained Checkpoints can be found in the <a class="reference external" href="http://bit.ly/3EGfKD4">Model Zoo</a></p>
  651. <p>Detailed list can be found <a class="reference external" href="http://bit.ly/3GnJwgZ">here</a></p>
  652. <div class="section" id="image-classification">
  653. <h2>Image Classification<a class="headerlink" href="#image-classification" title="Permalink to this heading"></a></h2>
  654. <ul class="simple">
  655. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/densenet.py">DensNet (Densely Connected Convolutional Networks)</a></p></li>
  656. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/dpn.py">DPN</a></p></li>
  657. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/efficientnet.py">EfficientNet</a></p></li>
  658. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/lenet.py">LeNet</a></p></li>
  659. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/mobilenet.py">MobileNet</a></p></li>
  660. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/mobilenetv2.py">MobileNet v2</a></p></li>
  661. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/mobilenetv3.py">MobileNet v3</a></p></li>
  662. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/pnasnet.py">PNASNet</a></p></li>
  663. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/preact_resnet.py">Pre-activation ResNet</a></p></li>
  664. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/regnet.py">RegNet</a></p></li>
  665. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/repvgg.py">RepVGG</a></p></li>
  666. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/resnet.py">ResNet</a></p></li>
  667. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/resnext.py">ResNeXt</a></p></li>
  668. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/senet.py">SENet </a></p></li>
  669. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/shufflenet.py">ShuffleNet</a></p></li>
  670. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/shufflenetv2.py">ShuffleNet v2</a></p></li>
  671. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/classification_models/vgg.py">VGG</a></p></li>
  672. </ul>
  673. </div>
  674. <div class="section" id="id8">
  675. <h2>Semantic Segmentation<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h2>
  676. <ul class="simple">
  677. <li><p><a class="reference external" href="https://bit.ly/3RrtMMO">PP-LiteSeg</a></p></li>
  678. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/segmentation_models/ddrnet.py">DDRNet (Deep Dual-resolution Networks)</a></p></li>
  679. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/segmentation_models/laddernet.py">LadderNet</a></p></li>
  680. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/segmentation_models/regseg.py">RegSeg</a></p></li>
  681. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/segmentation_models/shelfnet.py">ShelfNet</a></p></li>
  682. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/segmentation_models/stdc.py">STDC</a></p></li>
  683. </ul>
  684. </div>
  685. <div class="section" id="id9">
  686. <h2>Object Detection<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h2>
  687. <ul class="simple">
  688. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/detection_models/csp_darknet53.py">CSP DarkNet</a></p></li>
  689. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/detection_models/darknet53.py">DarkNet-53</a></p></li>
  690. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/detection_models/ssd.py">SSD (Single Shot Detector)</a></p></li>
  691. <li><p><a class="reference external" href="https://github.com/Deci-AI/super-gradients/blob/master/src/super_gradients/training/models/detection_models/yolox.py">YOLOX</a></p></li>
  692. </ul>
  693. <hr class="docutils" />
  694. </div>
  695. </div>
  696. <div class="section" id="documentation">
  697. <h1>Documentation<a class="headerlink" href="#documentation" title="Permalink to this heading"></a></h1>
  698. <p>Check SuperGradients <a class="reference external" href="https://deci-ai.github.io/super-gradients/welcome.html">Docs</a> for full documentation, user guide, and examples.</p>
  699. </div>
  700. <div class="section" id="contributing">
  701. <h1>Contributing<a class="headerlink" href="#contributing" title="Permalink to this heading"></a></h1>
  702. <p>To learn about making a contribution to SuperGradients, please see our <a class="reference internal" href="CONTRIBUTING.html"><span class="doc std std-doc">Contribution page</span></a>.</p>
  703. <p>Our awesome contributors:</p>
  704. <a href="https://github.com/Deci-AI/super-gradients/graphs/contributors">
  705. <img src="https://contrib.rocks/image?repo=Deci-AI/super-gradients" />
  706. </a>
  707. <p><br/>Made with <a class="reference external" href="https://contrib.rocks">contrib.rocks</a>.</p>
  708. </div>
  709. <div class="section" id="citation">
  710. <h1>Citation<a class="headerlink" href="#citation" title="Permalink to this heading"></a></h1>
  711. <p>If you are using SuperGradients library or benchmarks in your research, please cite SuperGradients deep learning training library.</p>
  712. </div>
  713. <div class="section" id="community">
  714. <h1>Community<a class="headerlink" href="#community" title="Permalink to this heading"></a></h1>
  715. <p>If you want to be a part of SuperGradients growing community, hear about all the exciting news and updates, need help, request for advanced features,
  716. or want to file a bug or issue report, we would love to welcome you aboard!</p>
  717. <ul class="simple">
  718. <li><p>Slack is the place to be and ask questions about SuperGradients and get support. <a class="reference external" href="https://join.slack.com/t/supergradients-comm52/shared_invite/zt-10vz6o1ia-b_0W5jEPEnuHXm087K~t8Q">Click here to join our Slack</a></p></li>
  719. <li><p>To report a bug, <a class="reference external" href="https://github.com/Deci-AI/super-gradients/issues">file an issue</a> on GitHub.</p></li>
  720. <li><p>Join the <a class="reference external" href="https://www.supergradients.com/#Newsletter">SG Newsletter</a>
  721. for staying up to date with new features and models, important announcements, and upcoming events.</p></li>
  722. <li><p>For a short meeting with us, use this <a class="reference external" href="https://calendly.com/ofer-baratz-deci/15min">link</a> and choose your preferred time.</p></li>
  723. </ul>
  724. </div>
  725. <div class="section" id="license">
  726. <h1>License<a class="headerlink" href="#license" title="Permalink to this heading"></a></h1>
  727. <p>This project is released under the <a class="reference internal" href="LICENSE.html"><span class="doc std std-doc">Apache 2.0 license</span></a>.</p>
  728. <hr class="docutils" />
  729. </div>
  730. <div class="section" id="deci-platform">
  731. <h1>Deci Platform<a class="headerlink" href="#deci-platform" title="Permalink to this heading"></a></h1>
  732. <p>Deci Platform is our end to end platform for building, optimizing and deploying deep learning models to production.</p>
  733. <p><a class="reference external" href="https://bit.ly/3qO3icq">Request free trial</a> to enjoy immediate improvement in throughput, latency, memory footprint and model size.</p>
  734. <p>Features:</p>
  735. <ul class="simple">
  736. <li><p>Automatically compile and quantize your models with just a few clicks (TensorRT, OpenVINO).</p></li>
  737. <li><p>Gain up to 10X improvement in throughput, latency, memory and model size.</p></li>
  738. <li><p>Easily benchmark your models’ performance on different hardware and batch sizes.</p></li>
  739. <li><p>Invite co-workers to collaborate on models and communicate your progress.</p></li>
  740. <li><p>Deci supports all common frameworks and Hardware, from Intel CPUs to Nvidia’s GPUs and Jetsons.
  741. ֿ</p></li>
  742. </ul>
  743. <p>Request free trial <a class="reference external" href="https://bit.ly/3qO3icq">here</a></p>
  744. </div>
  745. </div>
  746. </div>
  747. <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
  748. <a href="index.html" class="btn btn-neutral float-left" title="Welcome to SuperGradients’s documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
  749. <a href="super_gradients.common.html" class="btn btn-neutral float-right" title="Common package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
  750. </div>
  751. <hr/>
  752. <div role="contentinfo">
  753. <p>&#169; Copyright 2021, SuperGradients team.</p>
  754. </div>
  755. Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
  756. <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
  757. provided by <a href="https://readthedocs.org">Read the Docs</a>.
  758. </footer>
  759. </div>
  760. </div>
  761. </section>
  762. </div>
  763. <script>
  764. jQuery(function () {
  765. SphinxRtdTheme.Navigation.enable(true);
  766. });
  767. </script>
  768. </body>
  769. </html>
Tip!

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

Comments

Loading...