In[]:=
(*Builddataset*)​​get2[i_,str_:"0.5"]:=Block[{data,data1,pp},​​data=Import["C:\\Users\\MAYN\\Desktop\\WL\\data\\"<>str<>"\\0-"<>ToString[i]<>".txt","Table"];​​data1=Select[data,-3000<=#[[1]]<=3000&&#[[2]]<=3000&];​​pp=(data1[[;;,3]]~Partition~301)[[;;;;2,;;;;2]];​​NumericArray[{pp},"Real32"]​​]​​pp=get2[17,"3.0"];​​traindata=ParallelTable[Thread[get2[i-1,str]->get2[i,str]],{i,17},{str,{"0.5","1.0","2.0","3.0","8.0"}}];​​traindata=Flatten[traindata];​​testdata=ParallelTable[Thread[get2[i-1,str]->get2[i,str]],{i,17},{str,{"5.0"}}];
In[]:=
(*NeuralNetwork*)​​{imagexx,imageyy}={301,151};​​evalnet=NetInitialize@NetGraph[<|"net"->{ConvolutionLayer[1,4],Ramp,PoolingLayer[2,2],​​ConvolutionLayer[1,2],Ramp,PoolingLayer[2,2],FlattenLayer[],imagexx*imageyy,ReshapeLayer[{1,imagexx,imageyy}]},"Res"->TotalLayer[]|>,​​{NetPort["Input"]->{"net","Res"},​​"net"->"Res"},​​"Input"->{1,imagexx,imageyy}]​​net=NetGraph[<|"evalnet"evalnet,​​"loss"MeanAbsoluteLossLayer[]|>,​​{NetPort["Input"]"evalnet""loss"},​​"Input"{1,imagexx,imageyy}]
Out[]=
NetGraph
Inputport:
array(size: 1×301×151)
Outputport:
array(size: 1×301×151)
Data not saved. Save now

Out[]=
NetGraph
Number of inputs:
2
Lossport:
real
Data not saved. Save now

In[]:=
results=NetTrain[net,<|"Input"Keys@traindata,"Target"->Values@traindata|>,All,BatchSize->6,MaxTrainingRounds1000,TargetDevice->"GPU"]​​trained=results["TrainedNet"];​​tttrain=NetExtract[trained,"evalnet"]
Out[]=
NetTrainResultsObject
NetTrain Results
summary
batches:
15000,
rounds:
1000,
time:
2.3min
,
examples/s:
641
data
training examples:
85,
processed examples:
90000,
skipped examples:
0
method
ADAM
optimizer
,
batch size
6,
GPU
round
loss:
9.73
​
rounds
loss
​

Out[]=
NetGraph
InputPort
​
Input
:
array(size: 1×301×151)
OutputPort
Output
:
array(size: 1×301×151)
Data not saved. Save now

In[]:=
NetMeasurements[tttrain,<|"Input"->Flatten[Keys@testdata],"Output"->Flatten[Values@testdata]|>,"RSquared"]
Out[]=
-2.34033
​
​
​
​
​