Skip to content
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

Fixed some spelling/typos #276

Merged
merged 1 commit into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions deployment/libtorch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ The LibTorch inference for `yolort`, both GPU and CPU are supported.
1. Now, you can infer your own images.

```bash
./yolo_inference [--input_source ../../../test/assets/zidane.jpg]
[--checkpoint ../yolov5n.torchscript.pt]
[--labelmap ../../../notebooks/assets/coco.names]
[--gpu] # GPU switch, which is optional, and set False as default
./yolort_torch [--input_source ../../../test/assets/zidane.jpg]
[--checkpoint ../yolov5n.torchscript.pt]
[--labelmap ../../../notebooks/assets/coco.names]
[--gpu] # GPU switch, which is optional, and set False as default
```
4 changes: 2 additions & 2 deletions deployment/libtorch/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ int main(int argc, char* argv[]) {

// Run once to warm up
std::cout << "Run once on empty image" << std::endl;
auto img_dumy = torch::rand({3, 416, 320}, options);
auto img_dummy = torch::rand({3, 416, 320}, options);

images.push_back(img_dumy);
images.push_back(img_dummy);
inputs.push_back(images);

auto output = module.forward(inputs);
Expand Down
2 changes: 1 addition & 1 deletion deployment/tensorrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The TensorRT inference for `yolort`, support CUDA only.

## Usage

1. Create build director and cmake config.
1. Create build directory and cmake config.

```bash
mkdir -p build/ && cd build/
Expand Down
2 changes: 1 addition & 1 deletion notebooks/export-relay-inference-tvm.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Varify the Inference Output on TVM backend"
"## Verify the Inference Output on TVM backend"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/how-to-align-with-ultralytics-yolov5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
"id": "4f3f7c09",
"metadata": {},
"source": [
"## Varify the detection results between yolort and ultralytics"
"## Verify the detection results between yolort and ultralytics"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions notebooks/inference-pytorch-export-libtorch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Varify the PyTorch backend inference results"
"## Verify the PyTorch backend inference results"
]
},
{
Expand Down Expand Up @@ -375,7 +375,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Varify the Inference Output on LibTorch backend"
"## Verify the Inference Output on LibTorch backend"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/onnx-graphsurgeon-inference-tensorrt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@
"id": "00196f91-2b49-4b9d-8be7-aa8aea11c0ee",
"metadata": {},
"source": [
"## Varify the detection results between yolort and TensorRT"
"## Verify the detection results between yolort and TensorRT"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions test/test_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def run_model(
with torch.no_grad():
if isinstance(test_inputs, Tensor) or isinstance(test_inputs, list):
test_inputs = (test_inputs,)
test_ouputs = model(*test_inputs)
if isinstance(test_ouputs, Tensor):
test_ouputs = (test_ouputs,)
self.ort_validate(onnx_io, test_inputs, test_ouputs, tolerate_small_mismatch)
test_outputs = model(*test_inputs)
if isinstance(test_outputs, Tensor):
test_outputs = (test_outputs,)
self.ort_validate(onnx_io, test_inputs, test_outputs, tolerate_small_mismatch)

def ort_validate(self, onnx_io, inputs, outputs, tolerate_small_mismatch=False):

Expand Down
4 changes: 2 additions & 2 deletions tools/export_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def export_onnx(
Args:
model (nn.Module): The model to be exported.
inputs (Tuple[torch.Tensor]): The inputs to the model.
export_onnx_path (str): A string containg a file name. A binary Protobuf
export_onnx_path (str): A string containing a file name. A binary Protobuf
will be written to this file.
dynamic_axes (dict): A dictionary of dynamic axes.
input_names (str): A names list of input names.
Expand Down Expand Up @@ -110,7 +110,7 @@ def simplify_onnx(onnx_path, input_shapes):
# Load onnx mode
onnx_model = onnx.load(onnx_path)

# Simlify the ONNX model
# Simplify the ONNX model
model_sim, check = onnxsim.simplify(
onnx_model,
input_shapes=input_shapes,
Expand Down
2 changes: 1 addition & 1 deletion yolort/models/backbone_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BackboneWithPAN(nn.Module):
Adds a PAN on top of a model.
Internally, it uses torchvision.models._utils.IntermediateLayerGetter to
extract a submodel that returns the feature maps specified in return_layers.
The same limitations of IntermediatLayerGetter apply here.
The same limitations of IntermediateLayerGetter apply here.

Args:
backbone (nn.Module)
Expand Down
2 changes: 1 addition & 1 deletion yolort/relaying/trace_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_trace_module(
input_shape: Tuple[int, int] = (416, 416),
):
"""
Get the tarcing of a given model function.
Get the tracing of a given model function.

Example:

Expand Down
2 changes: 1 addition & 1 deletion yolort/runtime/trt_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(

model.load_state_dict(model_info["state_dict"])
self.model = model
self.num_clases = num_classes
self.num_classes = num_classes

@torch.no_grad()
def forward(self, inputs: Tensor) -> Tuple[Tensor, Tensor]:
Expand Down
2 changes: 1 addition & 1 deletion yolort/runtime/yolo_graphsurgeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(

# Fold constants via ONNX-GS that PyTorch2ONNX may have missed
self.graph.fold_constants()
self.num_classes = model.num_clases
self.num_classes = model.num_classes
self.batch_size = 1

def infer(self):
Expand Down
8 changes: 4 additions & 4 deletions yolort/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def anchor_match_visualize(images, targets, indices, anchors, pred):
)

# The anchors need to restore the offset.
# In eacy layer there has at most 3x3=9 anchors for matching.
# In each layer there has at most 3x3=9 anchors for matching.
anchor_restored = restore_anchor(anchor, grid_x, grid_y, stride, pred[i].shape, image_sizes)

# visualize positive anchor
Expand All @@ -309,13 +309,13 @@ def anchor_match_visualize(images, targets, indices, anchors, pred):
return images_with_anchor


def overlay_bbox(image, bboxs_list, color=None, thickness=2, font_scale=0.3, with_mask=False):
def overlay_bbox(image, bboxes_list, color=None, thickness=2, font_scale=0.3, with_mask=False):
"""
Visualize bbox in object detection by drawing rectangle.

Args:
image: numpy.ndarray.
bboxs_list: list: [pts_xyxy, prob, id]: label or prediction.
bboxes_list: list: [pts_xyxy, prob, id]: label or prediction.
color: tuple.
thickness: int.
font_scale: float.
Expand All @@ -329,7 +329,7 @@ def overlay_bbox(image, bboxs_list, color=None, thickness=2, font_scale=0.3, wit
txt = ""
COLORS = color_list() # list of COLORS

for bbox in bboxs_list:
for bbox in bboxes_list:
if len(bbox) == 5:
txt = "{:.3f}".format(bbox[4])
elif len(bbox) == 6:
Expand Down