Skip to content

Commit 286c3f2

Browse files
committed
RiFyFi_init
1 parent 79c3d59 commit 286c3f2

File tree

3 files changed

+222
-55
lines changed

3 files changed

+222
-55
lines changed

src/RiFyFi.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ function init(Param_Data,Param_Network)
132132
# ----------------------------------------------------
133133
@info "Init Network $(Param_Network.Networkname)"
134134
if Param_Network.Networkname == "AlexNet"
135-
(nn,loss)= initAlexNet(Param_Data.Chunksize,Param_Data.nbTx,Param_Network.Train_args.dr)
135+
(nn,loss)= initAlexNet(Param_Data.Chunksize,Param_Network.NbClass,Param_Network.Train_args.dr)
136136
elseif Param_Network.Networkname=="NewCNN"
137-
(nn,loss)= initNewCNN(Param_Data.Chunksize,Param_Data.nbTx,Param_Network.Train_args.dr)
137+
(nn,loss)= initNewCNN(Param_Data.Chunksize,Param_Network.NbClass,Param_Network.Train_args.dr)
138138
elseif Param_Network.Networkname == "GDA"
139-
(nn,loss)= initGDA(Param_Data.Chunksize,Param_Data.nbTx,Param_Network.Train_args.dr)
139+
(nn,loss)= initGDA(Param_Data.Chunksize,Param_Network.NbClass,Param_Network.Train_args.dr)
140140
elseif Param_Network.Networkname=="WiSig"
141-
(nn,loss)= initWiSig(Param_Data.Chunksize,Param_Data.nbTx,Param_Network.Train_args.dr)
141+
(nn,loss)= initWiSig(Param_Data.Chunksize,Param_Network.NbClass,Param_Network.Train_args.dr)
142142
end
143143
Param_Network.loss = loss
144144
Param_Network.model = nn

src/RiFyFi_VDG/src/utils_dict.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ function create_bigMat_Labels_Tx(new_bigLabels)
7777
end
7878
end
7979
end
80-
8180
return bigLabels
8281
end
8382

src/script_RiFyFi.jl

Lines changed: 218 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,41 @@ using .Results
2222

2323

2424
########### Synthetic Data struct ###########
25-
name = "5_pourcent"
25+
name = "10_pourcent"
2626
nameModel = name
27-
nbTx = 6 # Number of transmitters
27+
nbTx = 5 # Number of transmitters
2828
nbSignals = 2000 # number of signals per transmitters
2929
Chunksize = 256 # number of IQ samples per signals
3030
features= "IQsamples"
3131
S = "S1" # Use S1 for modelling a Preamble mode, S2 for MAC address and S3 for payload mode
3232
E = "E3" # Use E3 for adding fingerprint
33-
C = "C2_20dB" # Use C1 for perfect SNR, C2_0dB - C2_30dB to add Gaussian noise
33+
C = "C2" # Use C1 for perfect SNR, C2_0dB - C2_30dB to add Gaussian noise
3434
RFF = "all_impairments" # Use all_impairments to modeled the complete chaine, or use PA to model only the Power Amplifier, PN for Phase Noise, imbalance for IQ imbalance or cfo for carrier frequency offset.
3535
Normalisation = true # Use true to normalize the database
3636
pourcentTrain =0.9 # 90 % for train and 10% for test
3737
configuration = "scenario" # Use nothing to create random scenario, or use "scenario" to load a pre create scenario
38-
seed_data = 1234
39-
seed_model = 2345
38+
seed_data = 1235
39+
seed_model = 2343
4040
if E == "E1" || E == "E2"
4141
seed_modelTest = seed_model
4242
else
43-
seed_modelTest = 15987654321 * 100000000
43+
seed_modelTest = 1598765432 * 100000000
4444
end
4545
if S == "S1" || S == "S2"
4646
seed_dataTest = seed_data
4747
else
48-
seed_dataTest = 9999246912 * 100000000
48+
seed_dataTest = 999924691 * 100000000
4949
end
5050

5151

5252

53-
########### Augmentation struct ###########
54-
augmentationType = "augment"
55-
Channel = "etu"
56-
Channel_Test = "etu"
57-
nb_Augment = 100
58-
#seed_channel = 12
59-
#seed_channel_test = 12
60-
#burstSize =64
61-
62-
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
63-
64-
65-
6653

6754
########### Args Network struct ###########
68-
6955
η = 1e-5 # learning rate e-5
7056
dr = 0.25
7157
#λ = 0 # L2 regularizer param, implemented as weight decay
7258
batchsize = 64 # batch size
73-
epochs = 2 # number of epochs
59+
epochs = 1000 # number of epochs
7460
#seed = 12 # set seed > 0 for reproducibility
7561
use_cuda = true # if true use cuda (if available)
7662
#infotime = 1 # report every `infotime` epochs
@@ -86,58 +72,240 @@ Networkname = "AlexNet"
8672
NbClass = nbTx
8773
#Chunksize = 256
8874
NbSignals = nbSignals
89-
Seed_Network = 12
75+
Seed_Network = 14
9076
#Train_args = Args()
9177
#model = initAlexNet(256,4,Train_args.dr)[1]
9278
#loss = initAlexNet(256,4,Train_args.dr)[2]
9379
Train_args = RiFyFi_IdF.Args= η ,dr=dr, epochs= epochs,batchsize=batchsize,use_cuda=use_cuda)
80+
# ---------------------------------------------------------------------------------------------
81+
savepathbson=""
9482

9583

9684

97-
# ---------------------------------------------------------------------------------------------
98-
savepathbson=""
85+
########### Augmentation struct ###########
86+
augmentationType = "augment"
87+
Channel = "etu"
88+
Channel_Test = "etu"
89+
nb_Augment = 1
90+
#seed_channel = 12
91+
#seed_channel_test = 12
92+
#burstSize =64
9993

100-
# Creation of the data structure with the information of the dataset
101-
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
102-
# Train and test Datasets are created and saved in CSV files
103-
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
94+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
10495

96+
Table_seed_data = [1234,2345,3456,4567]
10597

106-
# Creation of the Network structure with the information of the network
107-
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
108-
# Train the network and save it
109-
RiFyFi.main(Param_Data,Param_Network)
98+
for i =1: 1 :size(Table_seed_data,1)
99+
Seed_Network = Table_seed_data[i]
100+
seed_data =Table_seed_data[i]
101+
# Creation of the data structure with the information of the dataset
102+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
103+
# Train and test Datasets are created and saved in CSV files
104+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
110105

111-
# Create a figure to show the evolution of the F1-score during the training
112-
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
113-
# Create a confusion matrix with testing dataset
114-
Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
115106

107+
# Creation of the Network structure with the information of the network
108+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
109+
# Train the network and save it
110+
RiFyFi.main(Param_Data,Param_Network)
116111

117-
# Define an other transmission scenario with the same RFF
118-
NbSignals_test = 1000
119-
C_test = "C2"
120-
configuration = "scenario" # use the previous RFF scenario to create new signals
112+
# Create a figure to show the evolution of the F1-score during the training
113+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
114+
# Create a confusion matrix with testing dataset
115+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
116+
end
121117

122-
# Use for example data augmentation to add different channel realisation
123-
Augmentation_Value_test = Augmentation.Data_Augmented_construct(augmentationType="augment",nb_Augment=2,Channel=Channel,Channel_Test=Channel_Test)
124-
# Creation of the new data structure with the information of the dataset
125-
Param_Data_test = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals_test, Chunksize,features,S,E,C_test,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value_test)
126-
# Train and test Datasets are created and saved in CSV files
118+
127119

128120

129-
RiFyFi_VDG.setSynthetiquecsv(Param_Data_test)
130121

131-
# Use the Param_Data_test dataset to evaluated the resilience of the trained network in the new transmission scenario
132-
Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data_test,[Seed_Network])
133122

134123

135-
136124

137125

126+
########### Augmentation struct ###########
127+
augmentationType = "augment"
128+
Channel = "etu"
129+
Channel_Test = "etu"
130+
nb_Augment = 20
131+
#seed_channel = 12
132+
#seed_channel_test = 12
133+
#burstSize =64
134+
135+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
136+
137+
for i =1: 1 :size(Table_seed_data,1)
138+
Seed_Network = Table_seed_data[i]
139+
seed_data =Table_seed_data[i]
140+
# Creation of the data structure with the information of the dataset
141+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
142+
# Train and test Datasets are created and saved in CSV files
143+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
144+
145+
146+
# Creation of the Network structure with the information of the network
147+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
148+
# Train the network and save it
149+
RiFyFi.main(Param_Data,Param_Network)
150+
151+
# Create a figure to show the evolution of the F1-score during the training
152+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
153+
# Create a confusion matrix with testing dataset
154+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
155+
end
156+
157+
158+
159+
160+
161+
162+
163+
164+
########### Augmentation struct ###########
165+
augmentationType = "augment"
166+
Channel = "etu"
167+
Channel_Test = "etu"
168+
nb_Augment = 40
169+
#seed_channel = 12
170+
#seed_channel_test = 12
171+
#burstSize =64
172+
173+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
174+
175+
176+
for i =1: 1 :size(Table_seed_data,1)
177+
Seed_Network = Table_seed_data[i]
178+
seed_data =Table_seed_data[i]
179+
# Creation of the data structure with the information of the dataset
180+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
181+
# Train and test Datasets are created and saved in CSV files
182+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
183+
184+
185+
# Creation of the Network structure with the information of the network
186+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
187+
# Train the network and save it
188+
RiFyFi.main(Param_Data,Param_Network)
189+
190+
# Create a figure to show the evolution of the F1-score during the training
191+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
192+
# Create a confusion matrix with testing dataset
193+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
194+
end
195+
196+
197+
198+
199+
200+
201+
########### Augmentation struct ###########
202+
augmentationType = "augment"
203+
Channel = "etu"
204+
Channel_Test = "etu"
205+
nb_Augment = 60
206+
#seed_channel = 12
207+
#seed_channel_test = 12
208+
#burstSize =64
209+
210+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
211+
138212

213+
for i =1: 1 :size(Table_seed_data,1)
214+
Seed_Network = Table_seed_data[i]
215+
seed_data =Table_seed_data[i]
216+
# Creation of the data structure with the information of the dataset
217+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
218+
# Train and test Datasets are created and saved in CSV files
219+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
139220

140221

222+
# Creation of the Network structure with the information of the network
223+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
224+
# Train the network and save it
225+
RiFyFi.main(Param_Data,Param_Network)
226+
227+
# Create a figure to show the evolution of the F1-score during the training
228+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
229+
# Create a confusion matrix with testing dataset
230+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
231+
end
232+
233+
234+
235+
236+
237+
238+
########### Augmentation struct ###########
239+
augmentationType = "augment"
240+
Channel = "etu"
241+
Channel_Test = "etu"
242+
nb_Augment = 80
243+
#seed_channel = 12
244+
#seed_channel_test = 12
245+
#burstSize =64
246+
247+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
248+
249+
for i =1: 1 :size(Table_seed_data,1)
250+
Seed_Network = Table_seed_data[i]
251+
seed_data =Table_seed_data[i]
252+
# Creation of the data structure with the information of the dataset
253+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
254+
# Train and test Datasets are created and saved in CSV files
255+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
256+
257+
258+
# Creation of the Network structure with the information of the network
259+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
260+
# Train the network and save it
261+
RiFyFi.main(Param_Data,Param_Network)
262+
263+
# Create a figure to show the evolution of the F1-score during the training
264+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
265+
# Create a confusion matrix with testing dataset
266+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
267+
end
268+
269+
270+
271+
272+
273+
274+
275+
276+
277+
278+
########### Augmentation struct ###########
279+
augmentationType = "augment"
280+
Channel = "etu"
281+
Channel_Test = "etu"
282+
nb_Augment = 100
283+
#seed_channel = 12
284+
#seed_channel_test = 12
285+
#burstSize =64
286+
287+
Augmentation_Value = RiFyFi_VDG.Data_Augmented(;augmentationType,Channel,Channel_Test,nb_Augment)
288+
289+
290+
for i =1: 1 :size(Table_seed_data,1)
291+
Seed_Network = Table_seed_data[i]
292+
seed_data =Table_seed_data[i]
293+
# Creation of the data structure with the information of the dataset
294+
Param_Data = RiFyFi_VDG.Data_Synth(name,nameModel,nbTx, NbSignals, Chunksize,features,S,E,C,RFF,Normalisation,pourcentTrain,configuration,seed_data,seed_model,seed_dataTest,seed_modelTest,Augmentation_Value)
295+
# Train and test Datasets are created and saved in CSV files
296+
RiFyFi_VDG.setSynthetiquecsv(Param_Data)
297+
298+
299+
# Creation of the Network structure with the information of the network
300+
Param_Network = RiFyFi_IdF.Network_struct(;Networkname,NbClass,Chunksize,NbSignals,Seed_Network,Train_args)
301+
# Train the network and save it
302+
RiFyFi.main(Param_Data,Param_Network)
303+
304+
# Create a figure to show the evolution of the F1-score during the training
305+
Results.main(Param_Data,Param_Network,"F1_score",savepathbson,Param_Data,[Seed_Network])
306+
# Create a confusion matrix with testing dataset
307+
#Results.main(Param_Data,Param_Network,"Confusion_Matrix",savepathbson,Param_Data,[Seed_Network])
308+
end
141309

142310

143311

0 commit comments

Comments
 (0)