This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import os | |
import onnx | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import cv2 | |
# Class for RPN | |
class RPN(nn.Module): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def xcorr_depthwise(x, kernel): | |
""" | |
Deptwise convolution for input and weights with the same shapes | |
Elementwise multiplication -> GlobalAveragePooling -> scalar mul on (kernel_h * kernel_w) | |
""" | |
# batch = kernel.size(0) # in our model batch = 1 | |
# channel = kernel.size(1) | |
# x = x.view(1, batch*channel, x.size(2), x.size(3)) # batch already = 1 | |
# kernel = kernel.view(batch*channel, 1, kernel.size(2), kernel.size(3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if (layer_type == "Gather") | |
{ | |
CV_Assert(node_proto.input_size() == 2); | |
Mat indexMat = getBlob(node_proto, constBlobs, 1); | |
CV_Assert_N(indexMat.type() == CV_32S, indexMat.total() == 1); | |
int index = indexMat.at<int>(0); | |
if ((constBlobs.find(node_proto.input(0)) != constBlobs.end())) | |
{ | |
Mat input = getBlob(node_proto, constBlobs, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef HAVE_DNN_NGRAPH | |
virtual Ptr<BackendNode> initNgraph(const std::vector<Ptr<BackendWrapper> > &inputs, | |
const std::vector<Ptr<BackendNode> >& nodes) CV_OVERRIDE | |
{ | |
auto& input = nodes[0].dynamicCast<InfEngineNgraphNode>()->node; | |
auto parent_shape = input->get_shape(); | |
std::cout << "parent_shape " << parent_shape << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <random> | |
#include <inference_engine.hpp> | |
#include <ngraph/ngraph.hpp> | |
#include <ngraph/opsets/opset.hpp> | |
using namespace InferenceEngine; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (inputs.size() == 2) | |
{ | |
int dims = outputs[0].dims; | |
int m = inputs[0].size[dims - 2]; | |
int n = inputs[0].size[dims - 1]; | |
int k = inputs[1].size[dims - 1]; | |
int rows = inputs[0].total() / (m * n); | |
MatShape sh_A = shape(rows, m * n); | |
MatShape sh_B = shape(rows, n * k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import argparse | |
import caffe | |
import numpy as np | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--proto_dir', '-i', default='proto', help='Path to directory with prototxt.') | |
parser.add_argument('--output_dir', '-o', default='output', help='Path to save directory.') | |
args, _ = parser.parse_known_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <random> | |
#include <inference_engine.hpp> | |
#include <ngraph/ngraph.hpp> | |
#include <ngraph/opsets/opset.hpp> | |
using namespace InferenceEngine; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FeatureL2Norm(torch.nn.Module): | |
def __init__(self): | |
super(FeatureL2Norm, self).__init__() | |
def forward(self, feature): | |
norm = torch.norm(feature, p=2, dim=1, keepdim=True) | |
return torch.div(feature, norm) |
We can't make this file beautiful and searchable because it's too large.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date,price,txCount,txVolume,activeAddresses,symbol,name,open,high,low,close,volume,market | |
2013-04-28,135.3,41702.0,68798683.4463,117984.0,BTC,Bitcoin,135.3,135.98,132.1,134.21,0.0,1500520000.0 | |
2013-04-28,4.3,9174.0,44319520.0666,17216.0,LTC,Litecoin,4.3,4.4,4.18,4.35,0.0,73773400.0 | |
2013-04-29,134.44,51602.0,113812845.38,86925.0,BTC,Bitcoin,134.44,147.49,134.0,144.54,0.0,1491160000.0 | |
2013-04-29,4.37,9275.0,36478096.6026,18395.0,LTC,Litecoin,4.37,4.57,4.23,4.38,0.0,74952700.0 | |
2013-04-30,144.0,47450.0,84266323.8547,76871.0,BTC,Bitcoin,144.0,146.93,134.05,139.0,0.0,1597780000.0 | |
2013-04-30,4.4,9099.0,40391660.1041,17810.0,LTC,Litecoin,4.4,4.57,4.17,4.3,0.0,75726800.0 | |
2013-05-01,139.0,55176.0,120682532.517,83564.0,BTC,Bitcoin,139.0,139.89,107.72,116.99,0.0,1542820000.0 | |
2013-05-01,4.29,8990.0,76374202.7997,16991.0,LTC,Litecoin,4.29,4.36,3.52,3.8,0.0,73901200.0 | |
2013-05-02,116.38,55295.0,93375328.6292,81920.0,BTC,Bitcoin,116.38,125.6,92.28,105.21,0.0,1292190000.0 |
NewerOlder