Skip to content

Commit

Permalink
update docs; convert box to float in generic evaluator
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: fairinternal/detectron2#327

Differential Revision: D18503824

Pulled By: ppwwyyxx

fbshipit-source-id: 4a75fc93f6efa75af31107f0b152ac9a683e9807
  • Loading branch information
ppwwyyxx authored and facebook-github-bot committed Nov 14, 2019
1 parent a677322 commit b355b92
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ For more advanced tutorials, refer to our [documentation](https://detectron2.rea
```
python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
--input input1.jpg input2.jpg \
[--other-options]
--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
```
The configs are made for training, therefore we need to specify `MODEL.WEIGHTS` to a model from model zoo for evaluation.
This command will run the inference and show visualizations in an OpenCV window.

For details of the command line arguments, see `demo.py -h`. Some common ones are:
* To run __on your webcam__, replace `--input files` with `--webcam`.
* To run __on a video__, replace `--input files` with `--video-input video.mp4`.
* To run __on cpu__, add `MODEL.DEVICE cpu` after `--opts`.
Expand Down
8 changes: 6 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ python setup.py build develop
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop
# or, as an alternative to `setup.py`, do
# pip install .
# pip install [--editable] .
```
Note: you may need to rebuild detectron2 after reinstalling a different build of PyTorch.

Expand Down Expand Up @@ -61,4 +61,8 @@ Note: you may need to rebuild detectron2 after reinstalling a different build of
```
print valid outputs at the time you build detectron2.

+ "invalid device function": you build detectron2 with one version of CUDA but run it with a different version.
+ "invalid device function": two possibilities:
* You build detectron2 with one version of CUDA but run it with a different version.
* Detectron2 is not built with the correct compute compability for the GPU model.
The compute compability defaults to match the GPU found on the machine,
and can be controlled by `TORCH_CUDA_ARCH_LIST` environment variable during installation.
2 changes: 1 addition & 1 deletion demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_parser():
)
parser.add_argument(
"--opts",
help="Modify model config options using the command-line",
help="Modify config options using the command-line 'KEY VALUE' pairs",
default=[],
nargs=argparse.REMAINDER,
)
Expand Down
1 change: 1 addition & 0 deletions detectron2/data/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def register(name, func):
func (callable): a callable which takes no arguments and returns a list of dicts.
"""
assert callable(func), "You must register a function with `DatasetCatalog.register`!"
assert name not in DatasetCatalog._REGISTERED, "Dataset '{}' is already registered!".format(name)
DatasetCatalog._REGISTERED[name] = func

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion detectron2/data/datasets/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def convert_to_coco_dict(dataset_name):
# "id" field must start with 1
coco_annotation["id"] = len(coco_annotations) + 1
coco_annotation["image_id"] = image_dict["image_id"]
coco_annotation["bbox"] = bbox
coco_annotation["bbox"] = [round(float(x), 3) for x in bbox]
coco_annotation["area"] = area
coco_annotation["category_id"] = annotation["category_id"]
coco_annotation["iscrowd"] = annotation.get("iscrowd", 0)
Expand Down
4 changes: 4 additions & 0 deletions detectron2/engine/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ class DefaultPredictor:
The predictor takes an BGR image, resizes it to the specified resolution,
runs the model and produces a dict of predictions.
This predictor takes care of model loading and input preprocessing for you.
If you'd like to do anything more fancy, please refer to its source code
as examples to build and use the model manually.
Attributes:
metadata (Metadata): the metadata of the underlying dataset, obtained from
cfg.DATASETS.TEST.
Expand Down

0 comments on commit b355b92

Please sign in to comment.