Skip to content

Instantly share code, notes, and snippets.

View xmfbit's full-sized avatar

xmfbit xmfbit

  • Bytedance
  • Beijing,China
View GitHub Profile
#include <iostream>
int main() {
std::cout << "HelloWorld!" << std::endl;
return 0;
}
@xmfbit
xmfbit / Karger_mincut_demo.cpp
Last active July 3, 2016 13:39
This is a demo for Karger's algorithm for graph min cut inspired by [Geeksforgeeks](http://www.geeksforgeeks.org/kargers-algorithm-for-minimum-cut-set-1-introduction-and-implementation/) and [Coursera: Algorithm design and analysis by Stanford University](https://www.coursera.org/learn/algorithm-design-analysis/home/week/3)
#include <iostream>
#include <vector>
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <cstdlib>
#include <ctime>
#include <sstream> // std::istringstream
#include <map>
@xmfbit
xmfbit / ResNet-50-test.proto
Created July 5, 2016 13:12
proto file for R-FCN using ResNet-50
name: "ResNet-50"
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224
input: "rois"
input_dim: 1 # to be changed on-the-fly to num ROIs
name: "fit_net"
layer {
name: "data"
type: "WindowPartitionData"
top: "data"
top: "param"
top: "label"
top: "mask"
param_data_param {
source: "/home/[email protected]/exp/lane_fit/data/train_list.txt"
@xmfbit
xmfbit / ocr_three_lstm.prototxt
Created September 28, 2016 02:00
3 lstm for ocr task
# has 3 lstm layer
name: "ocr"
layer {
name: "data"
type: "OCRData"
top: "data"
top: "label"
image_data_param {
is_color: false
@xmfbit
xmfbit / test_reorg_layer.cpp
Created January 16, 2017 08:48
test file for reorg_layer
#include <vector>
#include "gtest/gtest.h"
#include "caffe/common.hpp"
#include "caffe/blob.hpp"
#include "caffe/layers/reorg_layer.hpp"
#include "caffe/test/test_caffe_main.hpp"
namespace caffe {
template <typename TypeParam>
class ReorgLayerTest : public MultiDeviceTest<TypeParam> {
typedef typename TypeParam::Dtype Dtype;
@xmfbit
xmfbit / pytorch_mnist.py
Last active March 4, 2023 19:45
an example of pytorch on mnist dataset
import os
import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torch.nn.functional as F
import torch.optim as optim
## load mnist dataset
use_cuda = torch.cuda.is_available()
@xmfbit
xmfbit / convert.py
Created March 15, 2017 09:19
convert yolo cfg file to caffe prototxt file. If there are different definitions of `reorg` and `region` layer params, change the code.
# convert yolo cfg file to caffe prototxt file
import sys
import argparse
TYPES = ["Conv", "ReLU", "Pool", "Route", "Reorg", "Region"]
ACTIVATION_TYPES = ['leaky', 'linear']
layer_names = [];
def HasConflictNameError(conflicted_name):
print 'Error! The layer name \"{}\" has been in the list.'.format(conflicted_name)
@xmfbit
xmfbit / logger.py
Last active July 19, 2018 15:20
a wrapper file for logging in Python
# -*- coding: UTF-8 -*-
# File: logger.py
# Author: Yuxin Wu <[email protected]>
from __future__ import print_function
import logging
import os
import errno
import shutil
import os.path
from datetime import datetime
@xmfbit
xmfbit / FlowNetS-deploy.prototxt
Created June 21, 2017 10:37
Deploy prototxt file for FlowNetS, FlyingChairs dataset
# Enter your network definition here.
# Use Shift+Enter to update the visualization.
layer {
name: "CustomData1"
type: "CustomData"
top: "blob0"
top: "blob1"
top: "blob2"
top: "blob3"
include {