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

質問編集履歴

5

エラーメッセージの変更

2020/11/29 13:03

投稿

mainichiramen
mainichiramen

スコア2

title CHANGED
File without changes
body CHANGED
@@ -25,7 +25,17 @@
25
25
 
26
26
 
27
27
  ```
28
- newtrain_data = np.array(train_data)
28
+
29
+ C:\pleiades\python\3\lib\site-packages\numpy\core\_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
30
+ return array(a, dtype, copy=False, order=order)
31
+ Exception in Tkinter callback
32
+ Traceback (most recent call last):
33
+ File "C:\pleiades\python\3\lib\tkinter\__init__.py", line 1705, in __call__
34
+ return self.func(*args)
35
+ File "C:\pleiades\workspace\LogicCulc\LogicCulc_Chainer_v2\NetworkCreator\NetworkCreator.py", line 485, in selected_ds
36
+ newtrain_data = np.asarray(train_data)
37
+ File "C:\pleiades\python\3\lib\site-packages\numpy\core\_asarray.py", line 83, in asarray
38
+ return array(a, dtype, copy=False, order=order)
29
39
  ValueError: could not broadcast input array from shape (3,150,150) into shape (3)
30
40
  ```
31
41
 

4

補足情報を追加した

2020/11/29 13:03

投稿

mainichiramen
mainichiramen

スコア2

title CHANGED
File without changes
body CHANGED
@@ -135,5 +135,5 @@
135
135
  newtrain_dataの形状をnp.zeros((3,150,150))とnp.emptyで三次元の配列にそろえてみましたがうまくいきませんでした
136
136
 
137
137
  ### 補足情報(FW/ツールのバージョンなど)
138
-
139
- ここによ詳細な情報記載てください。
138
+ chainerのデータセットの作方は以下のサイト参考にました
139
+ https://qiita.com/tommyfms2/items/c3fa0cb258c17468cb30

3

タイトル変更

2020/11/29 12:49

投稿

mainichiramen
mainichiramen

スコア2

title CHANGED
@@ -1,1 +1,1 @@
1
- chainerを用いた自作画像セッ作成
1
+ リスからnumpy配列に変換できない
body CHANGED
File without changes

2

コードを全文入れた

2020/11/28 14:55

投稿

mainichiramen
mainichiramen

スコア2

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,5 @@
1
1
  ### 前提・実現したいこと
2
- 現在自作のデータセットを作り、そこからchainerを使って学習しようとしています。
2
+ 現在自作のカラー画像データセットを作り、そこからchainerを使って学習しようとしています。
3
3
  画像データセットは以下のように作っています
4
4
  ①ファイル先にある画像を読み込む(150×150のカラー画像)
5
5
  ②カラー画像の出力形式をRGBにする
@@ -32,6 +32,44 @@
32
32
  ### 該当のソースコード
33
33
 
34
34
  ```ここに言語名を入力
35
+ import os
36
+ import numpy as np
37
+ import glob
38
+ import cv2
39
+ import chainer
40
+ import pickle
41
+
42
+ from chainer import cuda, Function, gradient_check, report, training, utils, Variable
43
+ from chainer import datasets, iterators, optimizers, serializers
44
+ from chainer.datasets import tuple_dataset, TupleDataset
45
+
46
+ image_dir0 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\buildings"
47
+ image_dir1 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\forest"
48
+ image_dir2 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\glacier"
49
+ image_dir3 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\mountain"
50
+ image_dir4 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\sea"
51
+ image_dir5 = r"C:\Users\user\Desktop\archive\seg_train\seg_train\street"
52
+ image_dir6 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\buildings"
53
+ image_dir7 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\forest"
54
+ image_dir8 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\glacier"
55
+ image_dir9 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\mountain"
56
+ image_dir10 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\sea"
57
+ image_dir11 = r"C:\Users\user\Desktop\archive\seg_test\seg_test\street"
58
+
59
+ search_pattern = '*.jpg'
60
+
61
+ datas0 = []
62
+ datas1 = []
63
+ datas2 = []
64
+ datas3 = []
65
+ datas4 = []
66
+ datas5 = []
67
+ datas6 = []
68
+ datas7 = []
69
+ datas8 = []
70
+ datas9 = []
71
+ datas10= []
72
+ datas11= []
35
73
  #(画像データセットの作り方(これを12個作ります。))
36
74
  for image_path in glob.glob(os.path.join(image_dir0,search_pattern)):
37
75
  # (height,width,channels)

1

タイトルを変更いたしました

2020/11/28 14:06

投稿

mainichiramen
mainichiramen

スコア2

title CHANGED
@@ -1,1 +1,1 @@
1
- ValueError: could not broadcast input array from shape (3,150,150) into shape (3)
1
+ chainerを用いた自作画像セット作成
body CHANGED
File without changes