SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.34k stars 187 forks source link

How to convert List<NDArray> to NDArray #483

Open williamlzw opened 1 year ago

williamlzw commented 1 year ago

str = '00000.jpg 130,83,205,108,0 130,137,154,161,1 255,137,279,160,2 125,186,177,208,3 210,186,236,208,4 285,186,311,208,5 130,237,400,292,6 230,328,555,354,7' line = str.split() box = np.array([np.array(list(map(int, box.split(','))))for box in line[1:]]) print(box)

string str = "00000.jpg 130,83,205,108,0 130,137,154,161,1 255,137,279,160,2 125,186,177,208,3 210,186,236,208,4 285,186,311,208,5 130,237,400,292,6 230,328,555,354,7"; var line = str.Split(); List<List> allList = new List<List>(); var boxarr = line.Skip(1).Select(box => np.array(box.Split(',').Select(int.Parse))).ToList(); var aa = boxarr.ToArray();//How to convert List\<NDArray> to NDArray