Skip to content

Instantly share code, notes, and snippets.

View stoneyang's full-sized avatar
💭
I may be slow to respond.

stoneyang stoneyang

💭
I may be slow to respond.
View GitHub Profile
@stoneyang
stoneyang / smoothed_triplet_loss.py
Created October 16, 2018 08:05 — forked from chrischoy/smoothed_triplet_loss.py
Smoothed triplet loss from Deep Metric Learning via Lifted Structured Feature Embedding, CVPR 2016
import tensorflow as tf
import numpy as np
def smoothed_metric_loss(input_tensor, name='smoothed_triplet_loss', margin=1):
'''
input_tensor: require a tensor with predefined dimensions (No None dimension)
Every two consecutive vectors must be a positive pair. There
should not be more than one pair from each class.
'''
with tf.variable_scope(name):
@stoneyang
stoneyang / multilabel_example.py
Created August 9, 2018 12:51 — forked from bartolsthoorn/multilabel_example.py
Simple multi-laber classification example with Pytorch and MultiLabelSoftMarginLoss (https://en.wikipedia.org/wiki/Multi-label_classification)
import torch
import torch.nn as nn
import numpy as np
import torch.optim as optim
from torch.autograd import Variable
# (1, 0) => target labels 0+2
# (0, 1) => target labels 1
# (1, 1) => target labels 3
train = []
@stoneyang
stoneyang / tensorflow_self_check.py
Created April 18, 2018 11:34 — forked from mrry/tensorflow_self_check.py
[DEPRECATED] TensorFlow on Windows self-check
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@stoneyang
stoneyang / ZFNet_solver.prototxt
Last active September 23, 2016 13:48
ZFNet_train_val
net: "models/ZFNet/train_val.prototxt"
test_iter: 2000
test_interval: 2000
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 200000
display: 20
max_iter: 700000
momentum: 0.9
@stoneyang
stoneyang / readme.md
Created September 12, 2016 14:14 — forked from vsubhashini/readme.md
Sequence to Sequence - Video to Text (S2VT)
# set up Python environment: numpy for numerical routines, and matplotlib for plotting
import numpy as np
import matplotlib.pyplot as plt
# set display defaults
plt.rcParams['figure.figsize'] = (10, 10) # large images
plt.rcParams['image.interpolation'] = 'nearest' # don't interpolate: show square pixels
plt.rcParams['image.cmap'] = 'gray' # use grayscale output rather than a (potentially misleading) color heatmap
# The caffe module needs to be on the Python path;
Binxing Fang, http://en.wikipedia.org/wiki/Fang_Binxing
方滨兴,中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网 络方向首席科学家。
Gang Xiong, http://rd.springer.com/search?facet-author=%22Gang+Xiong%22
熊刚, 高级工程师, 研究方向为信息安全。E-mail: [email protected]
Weili Han, http://crypto.fudan.edu.cn/people/weili/
韩伟力, http://homepage.fudan.edu.cn/wlhan/en
This is just my personal gist clip.
@stoneyang
stoneyang / sshgfw
Created August 31, 2012 12:55 — forked from fuckgfw/sshgfw
#!/usr/bin/expect
set timeout 60
spawn /usr/bin/ssh -D 7070 -g [email protected]
#这里的 username 为你自己的用户名,yourserver.com 为你自己的服务器域名或ip
expect {
"password:" {
send "password\r"
#将第二个 password 改为你自己的密码
}
@stoneyang
stoneyang / SpaceEater.cpp
Created August 6, 2012 12:30
eat spaces more than one
#include <stdio.h>
main()
{
int c;
c = getchar();
while (c != EOF) {
putchar(c);
if (c == ' ') {
@stoneyang
stoneyang / EatAll.c
Created August 6, 2012 11:48
eat all spaces in the input characters
#include <stdio.h>
main()
{
int c;
while ((c = getchar()) != EOF) {
if (c == ' ') {
c = getchar();
if (c == ' ')