-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowDataNew.lua
More file actions
101 lines (94 loc) · 2.75 KB
/
ShowDataNew.lua
File metadata and controls
101 lines (94 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-- general libraries
require 'torch'
require 'paths'
require 'nn'
require 'gnuplot'
require 'lfs'
-- program requires
require 'Helper'
require 'TensorSaveLoad'
cmd = torch.CmdLine()
cmd:option('-f','IndianPines1_1','Folder')
params = cmd:parse(arg)
CestaRoot = "Out/"--/home/legomaniak/site3D/Out/
--CestaFolders = {"IndianPines1_1"}
CestaFolder = params.f
CestaSubFolders = {"/Train","/Test","/TestX"}
ListsInTrain = {}
listsInTest = {}
listsInTestX = {}
ListsOutTrain = {}
listsOutTest = {}
listsOutTestX = {}
--for CestaFolder in pairs(CestaFolders) do
for CestaSubFolder in pairs(CestaSubFolders) do
--listFolder=CestaRoot..CestaFolders[CestaFolder]..CestaSubFolders[CestaSubFolder]
listFolder=CestaRoot..CestaFolder..CestaSubFolders[CestaSubFolder]
for file in lfs.dir(listFolder) do
if lfs.attributes(listFolder.."/"..file,"mode") == "file" then
if string.find(file,".in") then
if CestaSubFolder==1 then
table.insert(ListsInTrain,file);
elseif CestaSubFolder==2 then
table.insert(listsInTest,file);
else
table.insert(listsInTestX,file);
end
elseif string.find(file,".out") then
if CestaSubFolder==1 then
table.insert(ListsOutTrain,file);
elseif CestaSubFolder==2 then
table.insert(listsOutTest,file);
else
table.insert(listsOutTestX,file);
end
end
end
end
end
end
function ShowListData(ListIn,ListOut)
local DataIn = NactiData(ListIn):squeeze();
local DataOut = NactiData(ListOut);
local t = {}
for i=1,DataIn:size(1) do
table.insert(t,{DataIn:select(1,i),'-'})
end
gnuplot.figure()
gnuplot.title(ListIn)
gnuplot.plot(t)
gnuplot.figure()
gnuplot.title(ListOut)
gnuplot.imagesc(DataOut,'color')
end
function ShowOutputData(ListIn,ListOut)
local DataIn = NactiData(ListIn):squeeze();
local DataOut = NactiData(ListOut);
for o=1,DataOut:size(2) do
local t = {}
for i=1,DataIn:size(1) do
if DataOut[i][o]==1 then
local d = DataIn:select(1,i)
local s = d:size()
ssize = 1;
for i = 1,s:size() do
ssize = ssize * s[i]
end
table.insert(t,{d:resize(ssize,1) ,'-'})
end
end
if table.getn(t)>0 then
gnuplot.figure()
gnuplot.title(ListIn)
gnuplot.plot(t)
end
end
gnuplot.figure()
gnuplot.title(ListOut)
gnuplot.imagesc(DataOut,'color')
end
for noLists in pairs(ListsInTrain) do
listFolder=CestaRoot..CestaFolder..CestaSubFolders[1].."/"
--ShowListData(listFolder..ListsInTrain[noLists],listFolder..ListsOutTrain[noLists])
ShowOutputData(listFolder..ListsInTrain[noLists],listFolder..ListsOutTrain[noLists])
end