Skip to content

Commit

Permalink
Merge pull request #60 from breezedeus/pytorch
Browse files Browse the repository at this point in the history
fix: clip the results
  • Loading branch information
breezedeus authored Jul 1, 2023
2 parents d46df69 + e5f5540 commit 40dd181
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package:
rm -rf build
python setup.py sdist bdist_wheel

VERSION = 1.2.3
VERSION = 1.2.3.1
upload:
python -m twine upload dist/cnstd-$(VERSION)* --verbose

Expand Down
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

# Update 2023.06.30:发布 V1.2.3.1

主要变更:
* 修复比例转换后检测框可能出界的问题。

# Update 2023.06.30:发布 V1.2.3

主要变更:
Expand Down
2 changes: 1 addition & 1 deletion cnstd/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# specific language governing permissions and limitations
# under the License.

__version__ = '1.2.3'
__version__ = '1.2.3.1'
2 changes: 1 addition & 1 deletion cnstd/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _vis_bool(img, fp):
help='使用训练好的模型。默认为 `None`,表示使用系统自带的预训练模型',
)
@click.option(
"-r", "--rotated-bbox", is_flag=True, help="是否检测带角度(非水平和垂直)的文本框。默认为 `True`"
"-r", "--rotated-bbox", is_flag=True, help="是否检测带角度(非水平和垂直)的文本框"
)
@click.option(
"--resized-shape",
Expand Down
4 changes: 3 additions & 1 deletion cnstd/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __call__(
For Image.Image, it should be generated from read_img;
For np.ndarray, it should be RGB-style, with shape [H, W, 3], scale [0, 255]
resized_shape: tuple, [height, width], height and width after resizing original images
preserve_aspect_ratio: whether or not presserve aspect ratio of original images when resizing them
preserve_aspect_ratio: whether or not preserve aspect ratio of original images when resizing them
min_box_size: minimal size of detected boxes; boxes with smaller height or width will be ignored
box_score_thresh: score threshold for boxes, boxes with scores lower than this value will be ignored
**kwargs:
Expand Down Expand Up @@ -207,7 +207,9 @@ def __call__(
_boxes = _boxes[:, :-1]
# resize back
_boxes[:, [0, 2]] /= compress_ratio[1]
_boxes[:, [0, 2]] = np.clip(_boxes[:, [0, 2]], 0.0, 1.0)
_boxes[:, [1, 3]] /= compress_ratio[0]
_boxes[:, [1, 3]] = np.clip(_boxes[:, [1, 3]], 0.0, 1.0)

out_boxes = _boxes.copy()
out_boxes[:, [0, 2]] *= rotated_img.shape[1]
Expand Down

0 comments on commit 40dd181

Please sign in to comment.