MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / darknet53_block

Method darknet53_block

examples/graph_yolov3.cpp:529–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 }
528
529 void darknet53_block(const std::string &data_path,
530 std::string &&param_path,
531 DataLayout weights_layout,
532 unsigned int filter_size)
533 {
534 std::string total_path = "/cnn_data/yolov3_model/";
535 std::string param_path2 =
536 arm_compute::support::cpp11::to_string(arm_compute::support::cpp11::stoi(param_path) + 1);
537 SubStream i_a(graph);
538 SubStream i_b(graph);
539 i_a << ConvolutionLayer(
540 1U, 1U, filter_size,
541 get_weights_accessor(data_path, total_path + "conv2d_" + param_path + "_w.npy", weights_layout),
542 std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0))
543 .set_name("conv2d_" + param_path + "/Conv2D")
544 << BatchNormalizationLayer(
545 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path + "_mean.npy"),
546 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path + "_var.npy"),
547 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path + "_gamma.npy"),
548 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path + "_beta.npy"),
549 0.000001f)
550 .set_name("conv2d_" + param_path + "/BatchNorm")
551 << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LEAKY_RELU, 0.1f))
552 .set_name("conv2d_" + param_path + "/LeakyRelu")
553 << ConvolutionLayer(
554 3U, 3U, filter_size * 2,
555 get_weights_accessor(data_path, total_path + "conv2d_" + param_path2 + "_w.npy", weights_layout),
556 std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 1, 1))
557 .set_name("conv2d_" + param_path2 + "/Conv2D")
558 << BatchNormalizationLayer(
559 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path2 + "_mean.npy"),
560 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path2 + "_var.npy"),
561 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path2 + "_gamma.npy"),
562 get_weights_accessor(data_path, total_path + "batch_normalization_" + param_path2 + "_beta.npy"),
563 0.000001f)
564 .set_name("conv2d_" + param_path2 + "/BatchNorm")
565 << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LEAKY_RELU, 0.1f))
566 .set_name("conv2d_" + param_path2 + "/LeakyRelu");
567
568 graph << EltwiseLayer(std::move(i_a), std::move(i_b), EltwiseOperation::Add)
569 .set_name("")
570 .set_name("add_" + param_path + "_" + param_path2);
571 }
572};
573
574/** Main program for YOLOv3

Callers

nothing calls this directly

Calls 10

stoiFunction · 0.85
ConvolutionLayerClass · 0.85
get_weights_accessorFunction · 0.85
PadStrideInfoClass · 0.85
ActivationLayerClass · 0.85
EltwiseLayerClass · 0.85
set_nameMethod · 0.80
to_stringFunction · 0.50
ActivationLayerInfoClass · 0.50

Tested by

no test coverage detected