1
- /** *****************************************************************************
1
+ /* *****************************************************************************
2
2
* Copyright (c) 2015-2019 Skymind, Inc.
3
3
*
4
4
* This program and the accompanying materials are made available under the
23
23
import org .datavec .api .split .InputSplit ;
24
24
import org .datavec .api .split .NumberedFileInputSplit ;
25
25
import org .deeplearning4j .datasets .datavec .SequenceRecordReaderDataSetIterator ;
26
- import org .deeplearning4j .datasets .iterator .AsyncDataSetIterator ;
27
- import org .deeplearning4j .eval .Evaluation ;
28
26
import org .deeplearning4j .nn .conf .BackpropType ;
29
27
import org .deeplearning4j .nn .conf .GradientNormalization ;
30
28
import org .deeplearning4j .nn .conf .MultiLayerConfiguration ;
36
34
import org .deeplearning4j .nn .multilayer .MultiLayerNetwork ;
37
35
import org .deeplearning4j .nn .weights .WeightInit ;
38
36
import org .deeplearning4j .optimize .listeners .ScoreIterationListener ;
37
+ import org .nd4j .evaluation .classification .Evaluation ;
39
38
import org .nd4j .linalg .activations .Activation ;
40
39
import org .nd4j .linalg .api .ndarray .INDArray ;
40
+ import org .nd4j .linalg .dataset .AsyncDataSetIterator ;
41
41
import org .nd4j .linalg .dataset .DataSet ;
42
42
import org .nd4j .linalg .dataset .api .DataSetPreProcessor ;
43
43
import org .nd4j .linalg .dataset .api .iterator .DataSetIterator ;
46
46
import org .nd4j .linalg .lossfunctions .LossFunctions ;
47
47
48
48
import java .io .File ;
49
+ import java .nio .charset .Charset ;
49
50
import java .util .HashMap ;
50
51
import java .util .Map ;
51
52
@@ -163,7 +164,7 @@ public static void main(String[] args) throws Exception {
163
164
while (trainData .hasNext ())
164
165
net .fit (trainData .next ());
165
166
Nd4j .saveBinary (net .params (),new File ("videomodel.bin" ));
166
- FileUtils .writeStringToFile (new File ("videoconf.json" ), conf .toJson ());
167
+ FileUtils .writeStringToFile (new File ("videoconf.json" ), conf .toJson (), ( Charset ) null );
167
168
System .out .println ("Epoch " + i + " complete" );
168
169
169
170
//Evaluate classification performance:
@@ -175,7 +176,7 @@ private static void generateData(String path) throws Exception {
175
176
File f = new File (path );
176
177
if (!f .exists ()) f .mkdir ();
177
178
178
- /** The data generation code does support the addition of background noise and distractor shapes (shapes which
179
+ /* The data generation code does support the addition of background noise and distractor shapes (shapes which
179
180
* are shown for one frame only in addition to the target shape) but these are disabled by default.
180
181
* These can be enabled to increase the complexity of the learning task.
181
182
*/
@@ -223,7 +224,7 @@ private static DataSetIterator getDataSetIterator(String dataDirectory, int star
223
224
return new AsyncDataSetIterator (sequenceIter ,1 );
224
225
}
225
226
226
- private static SequenceRecordReader getFeaturesReader (String path , int startIdx , int num ) throws Exception {
227
+ private static SequenceRecordReader getFeaturesReader (String path , int startIdx , int num ) {
227
228
//InputSplit is used here to define what the file paths look like
228
229
InputSplit is = new NumberedFileInputSplit (path + "shapes_%d.mp4" , startIdx , startIdx + num - 1 );
229
230
0 commit comments