teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

エラーメッセージをより詳細に書いた

2020/06/23 04:28

投稿

AIiver
AIiver

スコア2

title CHANGED
File without changes
body CHANGED
@@ -8,6 +8,101 @@
8
8
  ### 発生している問題・エラーメッセージ
9
9
 
10
10
  ```
11
+
12
+ Using TensorFlow backend.
13
+ ---------------------------------------------------------------------------
14
+ RuntimeError Traceback (most recent call last)
15
+ in
16
+ 5 from keras.models import Model
17
+ 6 from keras.preprocessing import image
18
+ ----> 7 import matplotlib.pyplot as plt
19
+ 8 import numpy as np
20
+ 9 from scipy.misc import imread
21
+
22
+ /Library/Python/3.7/site-packages/matplotlib/__init__.py in
23
+ 137 # cbook must import matplotlib only within function
24
+ 138 # definitions, so it is safe to import from it here.
25
+ --> 139 from . import cbook, rcsetup
26
+ 140 from matplotlib.cbook import (
27
+ 141 MatplotlibDeprecationWarning, dedent, get_label, sanitize_sequence)
28
+
29
+ /Library/Python/3.7/site-packages/matplotlib/rcsetup.py in
30
+ 25 from matplotlib import cbook
31
+ 26 from matplotlib.cbook import ls_mapper
32
+ ---> 27 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
33
+ 28 from matplotlib.colors import is_color_like
34
+ 29
35
+
36
+ /Library/Python/3.7/site-packages/matplotlib/fontconfig_pattern.py in
37
+ 16 import re
38
+ 17 import numpy as np
39
+ ---> 18 from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
40
+ 19 ParseException, Suppress)
41
+ 20
42
+
43
+ /Library/Python/3.7/site-packages/pyparsing.py in
44
+ 5670 stringEnd = StringEnd().setName("stringEnd")
45
+ 5671
46
+ -> 5672 _escapedPunc = Word(_bslash, r"[]-*.$+^?()~ ", exact=2).setParseAction(lambda s, l, t: t[0][1])
47
+ 5673 _escapedHexChar = Regex(r"\0?[xX][0-9a-fA-F]+").setParseAction(lambda s, l, t: unichr(int(t[0].lstrip(r'\0x'), 16)))
48
+ 5674 _escapedOctChar = Regex(r"\0[0-7]+").setParseAction(lambda s, l, t: unichr(int(t[0][1:], 8)))
49
+
50
+ /Library/Python/3.7/site-packages/pyparsing.py in setParseAction(self, *fns, **kwargs)
51
+ 1561 if not all(callable(fn) for fn in fns):
52
+ 1562 raise TypeError("parse actions must be callable")
53
+ -> 1563 self.parseAction = list(map(_trim_arity, list(fns)))
54
+ 1564 self.callDuringTry = kwargs.get("callDuringTry", False)
55
+ 1565 return self
56
+
57
+ /Library/Python/3.7/site-packages/pyparsing.py in _trim_arity(func, maxargs)
58
+ 1308 # IF ANY CODE CHANGES, EVEN JUST COMMENTS OR BLANK LINES, BETWEEN THE NEXT LINE AND
59
+ 1309 # THE CALL TO FUNC INSIDE WRAPPER, LINE_DIFF MUST BE MODIFIED!!!!
60
+ -> 1310 this_line = extract_stack(limit=2)[-1]
61
+ 1311 pa_call_line_synth = (this_line[0], this_line[1] + LINE_DIFF)
62
+ 1312
63
+
64
+ /Library/Python/3.7/site-packages/pyparsing.py in extract_stack(limit)
65
+ 1292 # special handling for Python 3.5.0 - extra deep call stack by 1
66
+ 1293 offset = -3 if system_version == (3, 5, 0) else -2
67
+ -> 1294 frame_summary = traceback.extract_stack(limit=-offset + limit - 1)[offset]
68
+ 1295 return [frame_summary[:2]]
69
+ 1296 def extract_tb(tb, limit=0):
70
+
71
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py in extract_stack(f, limit)
72
+ 209 if f is None:
73
+ 210 f = sys._getframe().f_back
74
+ --> 211 stack = StackSummary.extract(walk_stack(f), limit=limit)
75
+ 212 stack.reverse()
76
+ 213 return stack
77
+
78
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py in extract(klass, frame_gen, limit, lookup_lines, capture_locals)
79
+ 361 if lookup_lines:
80
+ 362 for f in result:
81
+ --> 363 f.line
82
+ 364 return result
83
+ 365
84
+
85
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py in line(self)
86
+ 283 def line(self):
87
+ 284 if self._line is None:
88
+ --> 285 self._line = linecache.getline(self.filename, self.lineno).strip()
89
+ 286 return self._line
90
+ 287
91
+
92
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py in getline(filename, lineno, module_globals)
93
+ 14
94
+ 15 def getline(filename, lineno, module_globals=None):
95
+ ---> 16 lines = getlines(filename, module_globals)
96
+ 17 if 1 <= lineno <= len(lines):
97
+ 18 return lines[lineno-1]
98
+
99
+ /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py in getlines(filename, module_globals)
100
+ 46 try:
101
+ 47 if module_globals is None:
102
+ ---> 48 for mod in sys.modules.values():
103
+ 49 if getattr(mod, '__file__', None) == filename:
104
+ 50 module_globals = mod.__dict__
105
+
11
106
  RuntimeError: dictionary changed size during iteration
12
107
  ```
13
108
 

1

該当するソースコードが違ったので、直しました。

2020/06/23 04:28

投稿

AIiver
AIiver

スコア2

title CHANGED
File without changes
body CHANGED
@@ -21,57 +21,23 @@
21
21
  from keras.preprocessing import image
22
22
  import matplotlib.pyplot as plt
23
23
  import numpy as np
24
- import pickle
25
- from random import shuffle
26
24
  from scipy.misc import imread
27
- from scipy.misc import imresize
28
25
  import tensorflow as tf
29
26
 
30
27
  from ssd import SSD300
31
- from ssd_training import MultiboxLoss
32
28
  from ssd_utils import BBoxUtility
33
29
 
34
- class Generator(object):
35
- def __init__(self, gt, bbox_util,
36
- batch_size, path_prefix,
37
- train_keys, val_keys, image_size,
38
- saturation_var=0.5,
39
- brightness_var=0.5,
40
- contrast_var=0.5,
30
+ %matplotlib inline
41
- lighting_std=0.5,
42
- hflip_prob=0.5,
43
- vflip_prob=0.5,
44
- do_crop=True,
45
- crop_area_range=[0.75, 1.0],
46
- aspect_ratio_range=[3./4., 4./3.]):
31
+ plt.rcParams['figure.figsize'] = (8, 8)
47
- self.gt = gt
48
- self.bbox_util = bbox_util
49
- self.batch_size = batch_size
50
- self.path_prefix = path_prefix
51
- self.train_keys = train_keys
52
- self.val_keys = val_keys
53
- self.train_batches = len(train_keys)
54
- self.val_batches = len(val_keys)
55
- self.image_size = image_size
56
- self.color_jitter = []
57
- if saturation_var:
58
- self.saturation_var = saturation_var
59
- self.color_jitter.append(self.saturation)
60
- if brightness_var:
61
- self.brightness_var = brightness_var
62
- self.color_jitter.append(self.brightness)
63
- if contrast_var:
64
- self.contrast_var = contrast_var
65
- self.color_jitter.append(self.contrast)
66
- self.lighting_std = lighting_std
67
- self.hflip_prob = hflip_prob
68
- self.vflip_prob = vflip_prob
69
- self.do_crop = do_crop
70
- self.crop_area_range = crop_area_range
71
- self.aspect_ratio_range = aspect_ratio_range
32
+ plt.rcParams['image.interpolation'] = 'nearest'
72
33
 
34
+ np.set_printoptions(suppress=True)
73
35
 
36
+ config = tf.ConfigProto()
37
+ config.gpu_options.per_process_gpu_memory_fraction = 0.45
38
+ set_session(tf.Session(config=config))
74
39
 
40
+
75
41
  ```ここに言語名を入力
76
42
  python
77
43
  ```