mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
Replace type(1) == int
with isinstance(1, int)
(#4217)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
ff5fa57415
commit
7dcdca3bf4
@ -22,7 +22,7 @@ repos:
|
|||||||
- id: detect-private-key
|
- id: detect-private-key
|
||||||
|
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.8.0
|
rev: v3.10.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
name: Upgrade code
|
name: Upgrade code
|
||||||
@ -50,7 +50,7 @@ repos:
|
|||||||
# exclude: "README.md|README.zh-CN.md|CONTRIBUTING.md"
|
# exclude: "README.md|README.zh-CN.md|CONTRIBUTING.md"
|
||||||
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- repo: https://github.com/PyCQA/flake8
|
||||||
rev: 6.0.0
|
rev: 6.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
name: PEP8
|
name: PEP8
|
||||||
|
@ -221,12 +221,12 @@ class Results(SimpleClass):
|
|||||||
if 'show_conf' in kwargs:
|
if 'show_conf' in kwargs:
|
||||||
deprecation_warn('show_conf', 'conf')
|
deprecation_warn('show_conf', 'conf')
|
||||||
conf = kwargs['show_conf']
|
conf = kwargs['show_conf']
|
||||||
assert type(conf) == bool, '`show_conf` should be of boolean type, i.e, show_conf=True/False'
|
assert isinstance(conf, bool), '`show_conf` should be of boolean type, i.e, show_conf=True/False'
|
||||||
|
|
||||||
if 'line_thickness' in kwargs:
|
if 'line_thickness' in kwargs:
|
||||||
deprecation_warn('line_thickness', 'line_width')
|
deprecation_warn('line_thickness', 'line_width')
|
||||||
line_width = kwargs['line_thickness']
|
line_width = kwargs['line_thickness']
|
||||||
assert type(line_width) == int, '`line_width` should be of int type, i.e, line_width=3'
|
assert isinstance(line_width, int), '`line_width` should be of int type, i.e, line_width=3'
|
||||||
|
|
||||||
names = self.names
|
names = self.names
|
||||||
pred_boxes, show_boxes = self.boxes, boxes
|
pred_boxes, show_boxes = self.boxes, boxes
|
||||||
|
@ -158,7 +158,7 @@ class FastSAMPrompt:
|
|||||||
contour_all = []
|
contour_all = []
|
||||||
temp = np.zeros((original_h, original_w, 1))
|
temp = np.zeros((original_h, original_w, 1))
|
||||||
for i, mask in enumerate(annotations):
|
for i, mask in enumerate(annotations):
|
||||||
if type(mask) == dict:
|
if isinstance(mask, dict):
|
||||||
mask = mask['segmentation']
|
mask = mask['segmentation']
|
||||||
annotation = mask.astype(np.uint8)
|
annotation = mask.astype(np.uint8)
|
||||||
if not retina:
|
if not retina:
|
||||||
@ -383,7 +383,7 @@ class FastSAMPrompt:
|
|||||||
points = [[int(point[0] * w / target_width), int(point[1] * h / target_height)] for point in points]
|
points = [[int(point[0] * w / target_width), int(point[1] * h / target_height)] for point in points]
|
||||||
onemask = np.zeros((h, w))
|
onemask = np.zeros((h, w))
|
||||||
for i, annotation in enumerate(masks):
|
for i, annotation in enumerate(masks):
|
||||||
mask = annotation['segmentation'] if type(annotation) == dict else annotation
|
mask = annotation['segmentation'] if isinstance(annotation, dict) else annotation
|
||||||
for i, point in enumerate(points):
|
for i, point in enumerate(points):
|
||||||
if mask[point[1], point[0]] == 1 and pointlabel[i] == 1:
|
if mask[point[1], point[0]] == 1 and pointlabel[i] == 1:
|
||||||
onemask += mask
|
onemask += mask
|
||||||
|
@ -791,7 +791,7 @@ class SettingsManager(dict):
|
|||||||
|
|
||||||
self.load()
|
self.load()
|
||||||
correct_keys = self.keys() == self.defaults.keys()
|
correct_keys = self.keys() == self.defaults.keys()
|
||||||
correct_types = all(type(a) == type(b) for a, b in zip(self.values(), self.defaults.values()))
|
correct_types = all(type(a) is type(b) for a, b in zip(self.values(), self.defaults.values()))
|
||||||
correct_version = check_version(self['settings_version'], self.version)
|
correct_version = check_version(self['settings_version'], self.version)
|
||||||
if not (correct_keys and correct_types and correct_version):
|
if not (correct_keys and correct_types and correct_version):
|
||||||
LOGGER.warning(
|
LOGGER.warning(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user