The following issues were found
modules/gapi/misc/python/package/gapi/__init__.py
111 issues
Line: 4
Column: 1
__all__ = ['op', 'kernel']
import sys
import cv2 as cv
# NB: Register function in specific module
def register(mname):
def parameterized(func):
sys.modules[mname].__dict__[func.__name__] = func
Reported by Pylint.
Line: 253
Column: 13
raise Exception('{} invalid input type for argument {}.\nExpected: {}, Actual: {}'
.format(cls.__name__, i, t.__name__, type(a).__name__))
op = cv.gapi.__op(op_id, cls.outMeta, *args)
out_protos = []
for i, out_type in enumerate(out_types):
if out_type == cv.GMat:
out_protos.append(op.getGMat())
Reported by Pylint.
Line: 253
Column: 18
raise Exception('{} invalid input type for argument {}.\nExpected: {}, Actual: {}'
.format(cls.__name__, i, t.__name__, type(a).__name__))
op = cv.gapi.__op(op_id, cls.outMeta, *args)
out_protos = []
for i, out_type in enumerate(out_types):
if out_type == cv.GMat:
out_protos.append(op.getGMat())
Reported by Pylint.
Line: 290
Column: 3
return kernel_with_params
# FIXME: On the c++ side every class is placed in cv2 module.
cv.gapi.wip.draw.Rect = cv.gapi_wip_draw_Rect
cv.gapi.wip.draw.Text = cv.gapi_wip_draw_Text
cv.gapi.wip.draw.Circle = cv.gapi_wip_draw_Circle
cv.gapi.wip.draw.Line = cv.gapi_wip_draw_Line
cv.gapi.wip.draw.Mosaic = cv.gapi_wip_draw_Mosaic
Reported by Pylint.
Line: 1
Column: 1
__all__ = ['op', 'kernel']
import sys
import cv2 as cv
# NB: Register function in specific module
def register(mname):
def parameterized(func):
sys.modules[mname].__dict__[func.__name__] = func
Reported by Pylint.
Line: 7
Column: 1
import cv2 as cv
# NB: Register function in specific module
def register(mname):
def parameterized(func):
sys.modules[mname].__dict__[func.__name__] = func
return func
return parameterized
Reported by Pylint.
Line: 15
Column: 1
@register('cv2.gapi')
def networks(*args):
return cv.gapi_GNetPackage(list(map(cv.detail.strip, args)))
@register('cv2.gapi')
def compile_args(*args):
Reported by Pylint.
Line: 20
Column: 1
@register('cv2.gapi')
def compile_args(*args):
return list(map(cv.GCompileArg, args))
@register('cv2')
def GIn(*args):
Reported by Pylint.
Line: 25
Column: 1
@register('cv2')
def GIn(*args):
return [*args]
@register('cv2')
def GOut(*args):
Reported by Pylint.
Line: 25
Column: 1
@register('cv2')
def GIn(*args):
return [*args]
@register('cv2')
def GOut(*args):
Reported by Pylint.
samples/python/common.py
108 issues
Line: 16
Column: 1
from functools import reduce
import numpy as np
import cv2 as cv
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
Reported by Pylint.
Line: 208
Column: 18
if PY3:
output = it.zip_longest(fillvalue=fillvalue, *args)
else:
output = it.izip_longest(fillvalue=fillvalue, *args)
return output
def mosaic(w, imgs):
'''Make a grid from images.
Reported by Pylint.
Line: 99
Column: 44
def show(self):
cv.imshow(self.windowname, self.dests[0])
def on_mouse(self, event, x, y, flags, param):
pt = (x, y)
if event == cv.EVENT_LBUTTONDOWN:
self.prev_pt = pt
elif event == cv.EVENT_LBUTTONUP:
self.prev_pt = None
Reported by Pylint.
Line: 139
Column: 1
channels.append(ch)
return np.uint8(np.array(channels).T*255)
def nothing(*arg, **kw):
pass
def clock():
return cv.getTickCount() / cv.getTickFrequency()
Reported by Pylint.
Line: 139
Column: 1
channels.append(ch)
return np.uint8(np.array(channels).T*255)
def nothing(*arg, **kw):
pass
def clock():
return cv.getTickCount() / cv.getTickFrequency()
Reported by Pylint.
Line: 172
Column: 43
cv.setMouseCallback(win, self.onmouse)
self.drag_start = None
self.drag_rect = None
def onmouse(self, event, x, y, flags, param):
x, y = np.int16([x, y]) # BUG
if event == cv.EVENT_LBUTTONDOWN:
self.drag_start = (x, y)
return
if self.drag_start:
Reported by Pylint.
Line: 15
Column: 1
if PY3:
from functools import reduce
import numpy as np
import cv2 as cv
# built-in modules
import os
import itertools as it
Reported by Pylint.
Line: 16
Column: 1
from functools import reduce
import numpy as np
import cv2 as cv
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
Reported by Pylint.
Line: 19
Column: 1
import cv2 as cv
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm']
Reported by Pylint.
Line: 19
Column: 1
import cv2 as cv
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '.ppm']
Reported by Pylint.
platforms/android/build_sdk.py
107 issues
Line: 26
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html
try:
log.debug("Executing: %s" % cmd)
log.info('Executing: ' + ' '.join(cmd))
retcode = subprocess.call(cmd, shell=shell)
if retcode < 0:
raise Fail("Child was terminated by signal: %s" % -retcode)
elif retcode > 0:
raise Fail("Child returned: %s" % retcode)
except OSError as e:
Reported by Bandit.
Line: 3
Column: 1
#!/usr/bin/env python
import os, sys
import argparse
import glob
import re
import shutil
import subprocess
import time
Reported by Pylint.
Line: 12
Column: 1
import time
import logging as log
import xml.etree.ElementTree as ET
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
class Fail(Exception):
def __init__(self, text=None):
Reported by Pylint.
Line: 17
Column: 5
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
class Fail(Exception):
def __init__(self, text=None):
self.t = text
def __str__(self):
return "ERROR" if self.t is None else self.t
def execute(cmd, shell=False):
Reported by Pylint.
Line: 24
Column: 9
def execute(cmd, shell=False):
try:
log.debug("Executing: %s" % cmd)
log.info('Executing: ' + ' '.join(cmd))
retcode = subprocess.call(cmd, shell=shell)
if retcode < 0:
raise Fail("Child was terminated by signal: %s" % -retcode)
elif retcode > 0:
Reported by Pylint.
Line: 25
Column: 9
def execute(cmd, shell=False):
try:
log.debug("Executing: %s" % cmd)
log.info('Executing: ' + ' '.join(cmd))
retcode = subprocess.call(cmd, shell=shell)
if retcode < 0:
raise Fail("Child was terminated by signal: %s" % -retcode)
elif retcode > 0:
raise Fail("Child returned: %s" % retcode)
Reported by Pylint.
Line: 32
Column: 9
elif retcode > 0:
raise Fail("Child returned: %s" % retcode)
except OSError as e:
raise Fail("Execution failed: %d / %s" % (e.errno, e.strerror))
def rm_one(d):
d = os.path.abspath(d)
if os.path.exists(d):
if os.path.isdir(d):
Reported by Pylint.
Line: 60
Column: 9
def check_executable(cmd):
try:
log.debug("Executing: %s" % cmd)
result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
if not isinstance(result, str):
result = result.decode("utf-8")
log.debug("Result: %s" % (result+'\n').split('\n')[0])
return True
Reported by Pylint.
Line: 64
Column: 9
result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
if not isinstance(result, str):
result = result.decode("utf-8")
log.debug("Result: %s" % (result+'\n').split('\n')[0])
return True
except Exception as e:
log.debug('Failed: %s' % e)
return False
Reported by Pylint.
Line: 66
Column: 12
result = result.decode("utf-8")
log.debug("Result: %s" % (result+'\n').split('\n')[0])
return True
except Exception as e:
log.debug('Failed: %s' % e)
return False
def determine_opencv_version(version_hpp_path):
# version in 2.4 - CV_VERSION_EPOCH.CV_VERSION_MAJOR.CV_VERSION_MINOR.CV_VERSION_REVISION
Reported by Pylint.
modules/python/test/test_misc.py
104 issues
Line: 9
Column: 1
from collections import namedtuple
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests, unittest
def is_numeric(dtype):
Reported by Pylint.
Line: 11
Column: 1
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests, unittest
def is_numeric(dtype):
return np.issubdtype(dtype, np.integer) or np.issubdtype(dtype, np.floating)
Reported by Pylint.
Line: 65
Column: 51
handler_called = [False]
def test_error_handler(status, func_name, err_msg, file_name, line):
handler_called[0] = True
cv.redirectError(test_error_handler)
try:
cv.imshow("", None) # This causes an assert
Reported by Pylint.
Line: 65
Column: 71
handler_called = [False]
def test_error_handler(status, func_name, err_msg, file_name, line):
handler_called[0] = True
cv.redirectError(test_error_handler)
try:
cv.imshow("", None) # This causes an assert
Reported by Pylint.
Line: 65
Column: 60
handler_called = [False]
def test_error_handler(status, func_name, err_msg, file_name, line):
handler_called[0] = True
cv.redirectError(test_error_handler)
try:
cv.imshow("", None) # This causes an assert
Reported by Pylint.
Line: 65
Column: 32
handler_called = [False]
def test_error_handler(status, func_name, err_msg, file_name, line):
handler_called[0] = True
cv.redirectError(test_error_handler)
try:
cv.imshow("", None) # This causes an assert
Reported by Pylint.
Line: 65
Column: 40
handler_called = [False]
def test_error_handler(status, func_name, err_msg, file_name, line):
handler_called[0] = True
cv.redirectError(test_error_handler)
try:
cv.imshow("", None) # This causes an assert
Reported by Pylint.
Line: 74
Column: 13
self.assertEqual("Dead code", 0)
except cv.error as _e:
self.assertEqual(handler_called[0], True)
pass
cv.redirectError(None)
try:
cv.imshow("", None) # This causes an assert
self.assertEqual("Dead code", 0)
Reported by Pylint.
Line: 128
Column: 16
def _try_to_convert(self, conversion, value):
try:
result = conversion(value).lower()
except Exception as e:
self.fail(
'{} "{}" is risen for conversion {} of type {}'.format(
type(e).__name__, e, value, type(value).__name__
)
)
Reported by Pylint.
Line: 179
Column: 3
a = np.zeros((2,3,4), dtype='f')
res5 = cv.utils.dumpInputArrayOfArrays([a, b])
self.assertEqual(res5, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=2 dims(-1)=1 size(-1)=2x1 type(0)=CV_32FC4 dims(0)=2 size(0)=3x2")
# TODO: fix conversion error
#a = np.zeros((2,3,4,5), dtype='f')
#res6 = cv.utils.dumpInputArray([a, b])
#self.assertEqual(res6, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=2 dims(-1)=1 size(-1)=2x1 type(0)=CV_32FC1 dims(0)=4 size(0)=[2 3 4 5]")
def test_parse_to_bool_convertible(self):
Reported by Pylint.
modules/ts/misc/color.py
102 issues
Line: 289
Column: 5
return minidx
if os.name == 'nt':
import msvcrt
from ctypes import windll, Structure, c_short, c_ushort, byref
SHORT = c_short
WORD = c_ushort
class COORD(Structure):
Reported by Pylint.
Line: 3
Column: 1
#!/usr/bin/env python
import math, os, sys
webcolors = {
"indianred": "#cd5c5c",
"lightcoral": "#f08080",
"salmon": "#fa8072",
"darksalmon": "#e9967a",
Reported by Pylint.
Line: 5
Column: 13
import math, os, sys
webcolors = {
"indianred": "#cd5c5c",
"lightcoral": "#f08080",
"salmon": "#fa8072",
"darksalmon": "#e9967a",
"lightsalmon": "#ffa07a",
Reported by Pylint.
Line: 345
Column: 1
def __init__(self, stream):
self.stream = stream
def write(self, *text, **attrs):
if text:
self.stream.write(" ".join([str(t) for t in text]))
class asciiSeqColorizer(object):
RESET_SEQ = "\033[0m"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
import math, os, sys
webcolors = {
"indianred": "#cd5c5c",
"lightcoral": "#f08080",
"salmon": "#fa8072",
"darksalmon": "#e9967a",
Reported by Pylint.
Line: 3
Column: 1
#!/usr/bin/env python
import math, os, sys
webcolors = {
"indianred": "#cd5c5c",
"lightcoral": "#f08080",
"salmon": "#fa8072",
"darksalmon": "#e9967a",
Reported by Pylint.
Line: 190
Column: 1
"#eeeeec",
]
def RGB2LAB(r,g,b):
if max(r,g,b):
r /= 255.
g /= 255.
b /= 255.
Reported by Pylint.
Line: 190
Column: 1
"#eeeeec",
]
def RGB2LAB(r,g,b):
if max(r,g,b):
r /= 255.
g /= 255.
b /= 255.
Reported by Pylint.
Line: 190
Column: 1
"#eeeeec",
]
def RGB2LAB(r,g,b):
if max(r,g,b):
r /= 255.
g /= 255.
b /= 255.
Reported by Pylint.
Line: 190
Column: 1
"#eeeeec",
]
def RGB2LAB(r,g,b):
if max(r,g,b):
r /= 255.
g /= 255.
b /= 255.
Reported by Pylint.
modules/ts/misc/summary.py
100 issues
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
numeric_re = re.compile("(\d+)")
cvtype_re = re.compile("(8U|8S|16U|16S|32S|32F|64F)C(\d{1,3})")
cvtypes = { '8U': 0, '8S': 1, '16U': 2, '16S': 3, '32S': 4, '32F': 5, '64F': 6 }
Reported by Pylint.
samples/dnn/download_models.py
98 issues
Line: 6
Column: 1
'''
from __future__ import print_function
import os
import cv2
import sys
import yaml
import argparse
import tarfile
import platform
Reported by Pylint.
Line: 19
Column: 5
from pathlib import Path
from datetime import datetime
if sys.version_info[0] < 3:
from urllib2 import urlopen
else:
from urllib.request import urlopen
import xml.etree.ElementTree as ET
__all__ = ["downloadFile"]
Reported by Pylint.
Line: 6
Column: 1
'''
from __future__ import print_function
import os
import cv2
import sys
import yaml
import argparse
import tarfile
import platform
Reported by Pylint.
Line: 35
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5
return 'Hash mismatch: expected {} vs actual of {}'.format(self.expected, self.actual)
def getHashsumFromFile(filepath):
sha = hashlib.sha1()
if os.path.exists(filepath):
print(' there is already a file with the same name')
with open(filepath, 'rb') as f:
while True:
buf = f.read(10*1024*1024)
Reported by Bandit.
Line: 107
Column: 16
print(' No expected hashsum provided, actual SHA is {}'.format(self.sha))
else:
checkHashsum(self.sha, filepath, silent=False)
except Exception as e:
print(" There was some problem with loading file {} for {}".format(self.filename, self.name))
print(" Exception: {}".format(e))
return
print(" Finished " + self.name)
Reported by Pylint.
Line: 123
Column: 41
self.download_sha = download_sha
self.archive_member = archive_member
def load(self, requested_file, sha, save_dir):
if self.download_sha is None:
download_dir = save_dir
else:
# create a new folder in save_dir to avoid possible name conflicts
download_dir = os.path.join(save_dir, self.download_sha)
Reported by Pylint.
Line: 154
Column: 24
else:
raise Exception("Downloaded file has different name")
def download(self, filepath):
print("Warning: download is not implemented, this is a base class")
return 0
def extract(self, requested_file, archive_path, save_dir):
filepath = os.path.join(save_dir, requested_file)
Reported by Pylint.
Line: 158
Column: 53
print("Warning: download is not implemented, this is a base class")
return 0
def extract(self, requested_file, archive_path, save_dir):
filepath = os.path.join(save_dir, requested_file)
try:
with tarfile.open(archive_path) as f:
if self.archive_member is None:
pathDict = dict((os.path.split(elem)[1], os.path.split(elem)[0]) for elem in f.getnames())
Reported by Pylint.
Line: 167
Column: 16
self.archive_member = pathDict[requested_file]
assert self.archive_member in f.getnames()
self.save(filepath, f.extractfile(self.archive_member))
except Exception as e:
print(' catch {}'.format(e))
def save(self, filepath, r):
with open(filepath, 'wb') as f:
print(' progress ', end="")
Reported by Pylint.
Line: 190
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen
self.url = url
def download(self, filepath):
r = urlopen(self.url, timeout=60)
self.printRequest(r)
self.save(filepath, r)
return os.path.getsize(filepath)
def printRequest(self, r):
Reported by Bandit.
doc/pattern_tools/gen_pattern.py
97 issues
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
Line: 21
Column: 1
import argparse
from svgfig import *
class PatternMaker:
def __init__(self, cols, rows, output, units, square_size, radius_rate, page_width, page_height):
self.cols = cols
Reported by Pylint.
modules/ts/misc/chart.py
96 issues
Line: 3
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
Line: 4
Column: 1
#!/usr/bin/env python
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
cvsize_re = re.compile("^\d+x\d+$")
cvtype_re = re.compile("^(CV_)(8U|8S|16U|16S|32S|32F|64F)(C\d{1,3})?$")
Reported by Pylint.
samples/dnn/siamrpnpp.py
96 issues
Line: 2
Column: 1
import argparse
import cv2 as cv
import numpy as np
import os
"""
Link to original paper : https://arxiv.org/abs/1812.11703
Link to original repo : https://github.com/STVIR/pysot
Reported by Pylint.
Line: 6
Column: 1
import numpy as np
import os
"""
Link to original paper : https://arxiv.org/abs/1812.11703
Link to original repo : https://github.com/STVIR/pysot
You can download the pre-trained weights of the Tracker Model from https://drive.google.com/file/d/11bwgPFVkps9AH2NOD1zBDdpF_tQghAB-/view?usp=sharing
You can download the target net (target branch of SiamRPN++) from https://drive.google.com/file/d/1dw_Ne3UMcCnFsaD6xkZepwE4GEpqq7U_/view?usp=sharing
Reported by Pylint.
Line: 33
Column: 21
"""
self.target_net.setInput(z)
outNames = self.target_net.getUnconnectedOutLayersNames()
self.zfs_1, self.zfs_2, self.zfs_3 = self.target_net.forward(outNames)
def track(self, x):
""" Takes the search of size (1, 1, 255, 255) as an input to generate classification score and bounding box regression
"""
self.search_net.setInput(x)
Reported by Pylint.
Line: 33
Column: 33
"""
self.target_net.setInput(z)
outNames = self.target_net.getUnconnectedOutLayersNames()
self.zfs_1, self.zfs_2, self.zfs_3 = self.target_net.forward(outNames)
def track(self, x):
""" Takes the search of size (1, 1, 255, 255) as an input to generate classification score and bounding box regression
"""
self.search_net.setInput(x)
Reported by Pylint.
Line: 33
Column: 9
"""
self.target_net.setInput(z)
outNames = self.target_net.getUnconnectedOutLayersNames()
self.zfs_1, self.zfs_2, self.zfs_3 = self.target_net.forward(outNames)
def track(self, x):
""" Takes the search of size (1, 1, 255, 255) as an input to generate classification score and bounding box regression
"""
self.search_net.setInput(x)
Reported by Pylint.
Line: 240
Column: 9
bbox: (x, y, w, h): bounding box
"""
x, y, w, h = bbox
self.center_pos = np.array([x + (w - 1) / 2, y + (h - 1) / 2])
self.h = h
self.w = w
w_z = self.w + self.track_context_amount * np.add(h, w)
h_z = self.h + self.track_context_amount * np.add(h, w)
s_z = round(np.sqrt(w_z * h_z))
Reported by Pylint.
Line: 241
Column: 9
"""
x, y, w, h = bbox
self.center_pos = np.array([x + (w - 1) / 2, y + (h - 1) / 2])
self.h = h
self.w = w
w_z = self.w + self.track_context_amount * np.add(h, w)
h_z = self.h + self.track_context_amount * np.add(h, w)
s_z = round(np.sqrt(w_z * h_z))
self.channel_average = np.mean(img, axis=(0, 1))
Reported by Pylint.
Line: 242
Column: 9
x, y, w, h = bbox
self.center_pos = np.array([x + (w - 1) / 2, y + (h - 1) / 2])
self.h = h
self.w = w
w_z = self.w + self.track_context_amount * np.add(h, w)
h_z = self.h + self.track_context_amount * np.add(h, w)
s_z = round(np.sqrt(w_z * h_z))
self.channel_average = np.mean(img, axis=(0, 1))
z_crop = self.get_subwindow(img, self.center_pos, self.track_exemplar_size, s_z, self.channel_average)
Reported by Pylint.
Line: 246
Column: 9
w_z = self.w + self.track_context_amount * np.add(h, w)
h_z = self.h + self.track_context_amount * np.add(h, w)
s_z = round(np.sqrt(w_z * h_z))
self.channel_average = np.mean(img, axis=(0, 1))
z_crop = self.get_subwindow(img, self.center_pos, self.track_exemplar_size, s_z, self.channel_average)
self.model.template(z_crop)
def track(self, img):
"""
Reported by Pylint.
Line: 304
Column: 9
cx, cy, width, height = self._bbox_clip(cx, cy, width, height, img.shape[:2])
# udpate state
self.center_pos = np.array([cx, cy])
self.w = width
self.h = height
bbox = [cx - width / 2, cy - height / 2, width, height]
best_score = score[best_idx]
return {'bbox': bbox, 'best_score': best_score}
Reported by Pylint.