Open mikechen66 opened 3 years ago
I update one of the major frcnn applications and make its train script to have a success run with calling measure_map.py. I judge that measure_map.py works fine. However, it has the same error (as above mentioned) while I use the following snippet to call measure_map.py in the frcnn. It is the most probable incompatibility between measure_map.py in the frcnn with the following snippet. If Douwe can deal with the issue, it will be much better.
import cv2
from measure_map import format_img
from keras_frcnn.rio_helpers import rpn_to_roi
from keras import backend as K
img = cv2.imread('data/cat_dog.jpg')
X, ratio = format_img(img, c)
# -if K.image_dim_ordering() == 'tf':
if K.image_data_format() == 'channels_last':
X = np.transpose(X, (0, 2, 3, 1))
y1, y2, f = model_rpn.predict(X)
r = keras_frcnn.roi_helpers.rpn_to_roi(y1, y2, c, K.image_dim_ordering(), overlap_thresh=0.7)
roi_count = R.shape[0] // c.num_rois
r2 = np.zeros((roi_count * c.num_rois, r.shape[1]))
r2 = r[:r2.shape[0],:r2.shape[1]]
r2 = np.reshape(r2, (roi_count, c.num_rois, r.shape[1]))
Hi Douwe:
After I add "from measure_map import format_img", the snippet can be run. But it has the following error. Please help figure it our. Thank a lot in advance.
_Usage: ipykernel_launcher.py [options]
ipykernel_launcher.py: error: no such option: -f ERROR:root:Internal Python error in the inspect module. Below is the traceback from this internal error.
Traceback (most recent call last): File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1387, in parse_args stop = self._process_args(largs, rargs, values) File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1431, in _process_args self._process_short_opts(rargs, values) File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1513, in _process_short_opts raise BadOptionError(opt) optparse.BadOptionError: no such option: -f
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/mike/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 2, in
from measure_map import format_img
File "/home/mike/Documents/dl-cookbook/keras_frcnn/measure_map.py", line 91, in
(options, args) = parser.parse_args()
File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1389, in parse_args
self.error(str(err))
File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1569, in error
self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
File "/home/mike/miniconda3/lib/python3.7/optparse.py", line 1559, in exit
sys.exit(status)
SystemExit: 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/mike/miniconda3/lib/python3.7/site-packages/IPython/core/ultratb.py", line 1169, in get_records return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset) File "/home/mike/miniconda3/lib/python3.7/site-packages/IPython/core/ultratb.py", line 316, in wrapped return f(*args, **kwargs) File "/home/mike/miniconda3/lib/python3.7/site-packages/IPython/core/ultratb.py", line 350, in _fixed_getinnerframes records = fix_frame_records_filenames(inspect.getinnerframes(etb, context)) File "/home/mike/miniconda3/lib/python3.7/inspect.py", line 1502, in getinnerframes frameinfo = (tb.tb_frame,) + getframeinfo(tb, context) AttributeError: 'tuple' object has no attribute 'tb_frame'
BadOptionError Traceback (most recent call last) ~/miniconda3/lib/python3.7/optparse.py in parse_args(self, args, values) 1386 try: -> 1387 stop = self._process_args(largs, rargs, values) 1388 except (BadOptionError, OptionValueError) as err:
~/miniconda3/lib/python3.7/optparse.py in _process_args(self, largs, rargs, values) 1430 # value(s) for the last one only) -> 1431 self._process_short_opts(rargs, values) 1432 elif self.allow_interspersed_args:
~/miniconda3/lib/python3.7/optparse.py in _process_short_opts(self, rargs, values) 1512 if not option: -> 1513 raise BadOptionError(opt) 1514 if option.takes_value():
BadOptionError: no such option: -f
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last) [... skipping hidden 1 frame]