hey guys ,i m using tiny yolo and it throwing me this error while importing:
Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidConfigException:
Invalid configuration for layer (idx=-1, name=convolution2d_2, type=ConvolutionLayer)
for width dimension:
Invalid input configuration for kernel width.
Require 0 < kW <= inWidth + 2*padW; got (kW=3, inWidth=2, padW=0)
Input type = InputTypeConvolutional(h=208,w=2,c=16,NCHW),
kernel = [3, 3],
strides = [1, 1],
padding = [0, 0],
layer size (output channels) = 32,
convolution mode = Same
heres my code:
String filename = "C:\\Users\\Nikki singh\\Downloads\\tiny-yolo-voc.h5";
ComputationGraph graph = KerasModelImport.importKerasModelAndWeights(filename, false);
double[][] priorBoxes = {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}};
INDArray priors = Nd4j.create( priorBoxes);
FineTuneConfiguration fineTuneConf = new FineTuneConfiguration.Builder()
.seed(123)
.optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
.gradientNormalization(GradientNormalization.RenormalizeL2PerLayer)
.gradientNormalizationThreshold(1.0)
.updater(new Adam.Builder().learningRate(1e-3).build())
.l2(0.00001)
.activation(Activation.IDENTITY)
.trainingWorkspaceMode(WorkspaceMode.ENABLED)
.inferenceWorkspaceMode(WorkspaceMode.ENABLED)
.build();
ComputationGraph model = new TransferLearning.GraphBuilder(graph)
.fineTuneConfiguration(fineTuneConf)
.addLayer("outputs", new Yolo2OutputLayer.Builder()
.boundingBoxPriors(priors)
.build(), "conv2d_9")
.setOutputs("outputs") .build();
System.out.println(model.summary(InputType.convolutional(130,130, 3)));
ModelSerializer.writeModel(model, "C:\\Users\\Nikki singh\\Downloads\\tiny-yolo-voc_dl4j_inference.v1.zip", false);
Error is on SecondLine here
ComputationGraph graph = KerasModelImport.importKerasModelAndWeights(filename, false);
what i m doing wrong …
Model can be downloaded from this link https://github.com/hollance/YOLO-CoreML-MPSNNGraph/blob/master/Convert/yad2k/model_data/tiny-yolo-voc.h5