Skip to content

sacred config for faster rcnn #1358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge
  • Loading branch information
Jerryzcn committed Jun 16, 2020
commit e73985a889e1cf3a3f9fcfb94a7707624a2b17ce
8 changes: 4 additions & 4 deletions docs/tutorials/pose/cam_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
detector.reset_class(classes=['person'], reuse_weights={'person':'person'})
detector.hybridize()

Next for the estimator, we choose ``simple_pose_resnet18_v1b`` for it is light-weighted.
Next for the estimators, we choose ``simple_pose_resnet18_v1b`` for it is light-weighted.

The default ``simple_pose_resnet18_v1b`` model was trained with input size 256x192.
We also provide an optional ``simple_pose_resnet18_v1b`` model trained with input size 128x96.
Expand All @@ -61,8 +61,8 @@

.. code-block:: python

estimator = get_model('simple_pose_resnet18_v1b', pretrained='ccd24037', ctx=ctx)
estimator.hybridize()
estimators = get_model('simple_pose_resnet18_v1b', pretrained='ccd24037', ctx=ctx)
estimators.hybridize()

With OpenCV, we can easily retrieve frames from the webcam.

Expand Down Expand Up @@ -107,7 +107,7 @@
pose_input, upscale_bbox = detector_to_simple_pose(frame, class_IDs, scores, bounding_boxs,
output_shape=(128, 96), ctx=ctx)
if len(upscale_bbox) > 0:
predicted_heatmap = estimator(pose_input)
predicted_heatmap = estimators(pose_input)
pred_coords, confidence = heatmap_to_coord(predicted_heatmap, upscale_bbox)

img = cv_plot_keypoints(frame, pred_coords, confidence, class_IDs, bounding_boxs, scores,
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion gluoncv/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class SSDMultiBoxLoss(gluon.Block):
negative_mining_ratio : float, default is 3
Ratio of negative vs. positive samples.
rho : float, default is 1.0
Threshold for trimmed mean estimator. This is the smooth parameter for the
Threshold for trimmed mean estimators. This is the smooth parameter for the
L1-L2 transition.
lambd : float, default is 1.0
Relative weight between classification and box regression loss.
Expand Down
2 changes: 1 addition & 1 deletion gluoncv/pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""GluonCV pipelines"""
from .estimator import *
from .estimators import *
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
import time

import mxnet as mx
from mxnet import gluon

import numpy as np
from mxnet import gluon

from ... import data as gdata
from ...data.batchify import FasterRCNNTrainBatchify, Tuple, Append
from ...data.sampler import SplitSortedBucketSampler
from ...data.transforms import presets
from ...data.transforms.presets.rcnn import FasterRCNNDefaultTrainTransform, \
from gluoncv import data as gdata
from gluoncv.data.batchify import FasterRCNNTrainBatchify, Tuple, Append
from gluoncv.data.sampler import SplitSortedBucketSampler
from gluoncv.data.transforms import presets
from gluoncv.data.transforms.presets.rcnn import FasterRCNNDefaultTrainTransform, \
FasterRCNNDefaultValTransform
from ...model_zoo import get_model
from ...model_zoo.rcnn.faster_rcnn.data_parallel import ForwardBackwardTask
from ...nn.bbox import BBoxClipToImage
from ...utils.metrics.coco_detection import COCODetectionMetric
from ...utils.metrics.rcnn import RPNAccMetric, RPNL1LossMetric, RCNNAccMetric, \
from gluoncv.model_zoo import get_model
from gluoncv.model_zoo.rcnn.faster_rcnn.data_parallel import ForwardBackwardTask
from gluoncv.nn.bbox import BBoxClipToImage
from gluoncv.pipelines.estimators.base_estimator import BaseEstimator
from gluoncv.utils.metrics.coco_detection import COCODetectionMetric
from gluoncv.utils.metrics.rcnn import RPNAccMetric, RPNL1LossMetric, RCNNAccMetric, \
RCNNL1LossMetric
from ...utils.metrics.voc_detection import VOC07MApMetric
from ...utils.parallel import Parallel
from gluoncv.utils.metrics.voc_detection import VOC07MApMetric
from gluoncv.utils.parallel import Parallel

try:
import horovod.mxnet as hvd
Expand Down Expand Up @@ -116,18 +116,18 @@ def _get_dataset(dataset, args):
return train_dataset, val_dataset, val_metric


class FasterRCNNEstimator:
class FasterRCNNEstimator(BaseEstimator):
""" Estimator for Faster R-CNN.
"""

def __init__(self, cfg, logger=None):
"""
Constructs Faster R-CNN estimator.
Constructs Faster R-CNN estimators.

Parameters
----------
cfg : configuration object
Configuration object containing information for constructing Faster R-CNN estimator.
Configuration object containing information for constructing Faster R-CNN estimators.
logger : logger object, default is None
If not `None`, will use default logging object.
"""
Expand Down Expand Up @@ -301,8 +301,7 @@ def _validate(self, val_data, ctx, eval_metric):
eval_metric.update(det_bbox, det_id, det_score, gt_bbox, gt_id, gt_diff)
return eval_metric.get()

def fit(self):

def _fit(self):
"""
Fit faster R-CNN models.
"""
Expand Down
2 changes: 1 addition & 1 deletion scripts/detection/faster_rcnn/train_faster_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

gcv.utils.check_version('0.7.0')
from gluoncv import utils as gutils
from gluoncv.estimators.rcnn.faster_rcnn import FasterRCNNEstimator
from gluoncv.pipelines.estimators.rcnn import FasterRCNNEstimator

try:
import horovod.mxnet as hvd
Expand Down