質問編集履歴

4

直したコードの引数が直されておりませんでした、申し訳ございません。

2018/07/25 16:13

投稿

reishisu
reishisu

スコア39

test CHANGED
File without changes
test CHANGED
@@ -176,7 +176,7 @@
176
176
 
177
177
 
178
178
 
179
- def changeToGray( number: int, width: np.ndarray ):
179
+ def changeToGray( number: int, length: int ):
180
180
 
181
181
  """
182
182
 
@@ -212,7 +212,7 @@
212
212
 
213
213
 
214
214
 
215
- def mulchProcess(useCPU: int):
215
+ def mulchProcess(useCPU: int, step: int):
216
216
 
217
217
  """
218
218
 
@@ -228,7 +228,7 @@
228
228
 
229
229
  with concurrent.futures.ProcessPoolExecutor(max_workers=useCPU) as executer:
230
230
 
231
- fs = [ executer.submit(changeToGray2, i, step) for i in index_list ]
231
+ fs = [ executer.submit(changeToGray, i, step) for i in index_list ]
232
232
 
233
233
  for future in concurrent.futures.as_completed(fs):
234
234
 

3

よくみたけどあの人の言いたいことがわからない、、、

2018/07/25 16:13

投稿

reishisu
reishisu

スコア39

test CHANGED
File without changes
test CHANGED
@@ -192,8 +192,6 @@
192
192
 
193
193
  """
194
194
 
195
- start = time.time()
196
-
197
195
  endPioint = number + length if number + length < len(img) else len(img) - 1
198
196
 
199
197
  part_height = img[ number : endPioint-1 ]

2

私なりの見解と実行時間と使用画像を追加しました。

2018/07/24 15:38

投稿

reishisu
reishisu

スコア39

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
 
12
12
 
13
+ 個人的には、並列化した時の通信時間よりforの方が時間がかかっている感じがするのでこのような結果になったのではないかなぁと推測しております。
14
+
15
+
16
+
13
17
  ### 元のソースコード
14
18
 
15
19
  ```Python3
@@ -271,3 +275,13 @@
271
275
  メモリ : 16 GB 2133 MHz LPDDR3
272
276
 
273
277
  Python 3.6.4
278
+
279
+
280
+
281
+ [実行時間]
282
+
283
+ 使用画像 : 5000px*5025px (15.1MB)
284
+
285
+ 修正前のコード : 44.79758310317993秒
286
+
287
+ 修正後のコード : 45.401297092437744秒

1

画像読み込みのところを編集しました。

2018/07/24 15:01

投稿

reishisu
reishisu

スコア39

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
 
26
26
 
27
- img = common.getRGBImage( sys.argv[1] )
27
+ img = cv2.cvtColor(cv2.imread(sys.argv[1]), cv2.COLOR_BGR2RGB)
28
28
 
29
29
  useCPU = 1
30
30
 
@@ -134,7 +134,7 @@
134
134
 
135
135
 
136
136
 
137
- img = common.getRGBImage( sys.argv[1] )
137
+ img = cv2.cvtColor(cv2.imread(sys.argv[1]), cv2.COLOR_BGR2RGB)
138
138
 
139
139
  useCPU = 1
140
140