Identity is not the same thing as equality in Python (#291)

Use ==/!= to compare str, bytes, and int literals
$ python
```python
>>> method = 'Mi'
>>> method += 'n'
>>> method == 'Min'
True
>>> method is 'Min'
False
```
This commit is contained in:
cclauss 2019-06-27 19:10:22 +02:00 committed by iperov
parent 8484060e01
commit 93ee889597

View file

@ -291,7 +291,7 @@ def nms(boxes, threshold, method):
w = np.maximum(0.0, xx2-xx1+1) w = np.maximum(0.0, xx2-xx1+1)
h = np.maximum(0.0, yy2-yy1+1) h = np.maximum(0.0, yy2-yy1+1)
inter = w * h inter = w * h
if method is 'Min': if method == 'Min':
o = inter / np.minimum(area[i], area[idx]) o = inter / np.minimum(area[i], area[idx])
else: else:
o = inter / (area[i] + area[idx] - inter) o = inter / (area[i] + area[idx] - inter)