Unverified Commit a97fc87b authored by Jintao Lin's avatar Jintao Lin Committed by GitHub
Browse files

[Docs] Add modelzoo statistics and polish docs (#201)

* add model stastics

* add model stastics and polish docs

* add model stastics and polish docs

* fix

* chmod +x stat.py
parent 20b163a4
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
import os import os
import subprocess
import sys import sys
from m2r import MdInclude from m2r import MdInclude
from recommonmark.transform import AutoStructify from recommonmark.transform import AutoStructify
...@@ -87,7 +88,12 @@ html_theme = 'sphinx_rtd_theme' ...@@ -87,7 +88,12 @@ html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static'] html_static_path = ['_static']
def builder_inited_handler(app):
subprocess.run(['./stat.py'])
def setup(app): def setup(app):
app.connect('builder-inited', builder_inited_handler)
app.add_config_value('no_underscore_emphasis', False, 'env') app.add_config_value('no_underscore_emphasis', False, 'env')
app.add_config_value('m2r_parse_relative_links', False, 'env') app.add_config_value('m2r_parse_relative_links', False, 'env')
app.add_config_value('m2r_anonymous_references', False, 'env') app.add_config_value('m2r_anonymous_references', False, 'env')
......
#!/usr/bin/env python
import glob
import re
from os import path as osp
url_prefix = 'https://github.com/open-mmlab/mmdetection3d/blob/master/'
files = sorted(glob.glob('../configs/*/README.md'))
stats = []
titles = []
num_ckpts = 0
for f in files:
url = osp.dirname(f.replace('../', url_prefix))
with open(f, 'r') as content_file:
content = content_file.read()
title = content.split('\n')[0].replace('#', '')
titles.append(title)
ckpts = set(x.lower().strip()
for x in re.findall(r'https?://download.*\.pth', content)
if 'mmdetection3d' in x)
num_ckpts += len(ckpts)
statsmsg = f"""
\t* [{title}]({url}) ({len(ckpts)} ckpts)
"""
stats.append((title, ckpts, statsmsg))
msglist = '\n'.join(x for _, _, x in stats)
modelzoo = f"""
\n## Model Zoo Statistics
* Number of papers: {len(titles)}
* Number of checkpoints: {num_ckpts}
{msglist}
"""
with open('model_zoo.md', 'a') as f:
f.write(modelzoo)
...@@ -7,8 +7,8 @@ class TwoStage3DDetector(Base3DDetector, TwoStageDetector): ...@@ -7,8 +7,8 @@ class TwoStage3DDetector(Base3DDetector, TwoStageDetector):
"""Base class of two-stage 3D detector. """Base class of two-stage 3D detector.
It inherits original ``:class:TwoStageDetector`` and It inherits original ``:class:TwoStageDetector`` and
``:class:Base3DDetector``. This class could serve as a base class ``:class:Base3DDetector``. This class could serve as a base class for all
for all two-stage 3D detectors. two-stage 3D detectors.
""" """
def __init__(self, **kwargs): def __init__(self, **kwargs):
......
...@@ -93,7 +93,7 @@ class Base3DRoIHead(nn.Module, metaclass=ABCMeta): ...@@ -93,7 +93,7 @@ class Base3DRoIHead(nn.Module, metaclass=ABCMeta):
def aug_test(self, x, proposal_list, img_metas, rescale=False, **kwargs): def aug_test(self, x, proposal_list, img_metas, rescale=False, **kwargs):
"""Test with augmentations. """Test with augmentations.
If rescale is False, then returned bboxes and masks will fit the If rescale is False, then returned bboxes and masks will fit the scale
scale of imgs[0]. of imgs[0].
""" """
pass pass
...@@ -7,8 +7,8 @@ from . import furthest_point_sample_ext ...@@ -7,8 +7,8 @@ from . import furthest_point_sample_ext
class FurthestPointSampling(Function): class FurthestPointSampling(Function):
"""Furthest Point Sampling. """Furthest Point Sampling.
Uses iterative furthest point sampling to select a set of features Uses iterative furthest point sampling to select a set of features whose
whose corresponding points have the furthest distance. corresponding points have the furthest distance.
""" """
@staticmethod @staticmethod
......
...@@ -5,9 +5,8 @@ import torch ...@@ -5,9 +5,8 @@ import torch
def scatter_nd(indices, updates, shape): def scatter_nd(indices, updates, shape):
"""pytorch edition of tensorflow scatter_nd. """pytorch edition of tensorflow scatter_nd.
this function don't contain except handle code. so use this this function don't contain except handle code. so use this carefully when
carefully when indice repeats, don't support repeat add which is indice repeats, don't support repeat add which is supported in tensorflow.
supported in tensorflow.
""" """
ret = torch.zeros(*shape, dtype=updates.dtype, device=updates.device) ret = torch.zeros(*shape, dtype=updates.dtype, device=updates.device)
ndim = indices.shape[-1] ndim = indices.shape[-1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment