Skip to content

Instantly share code, notes, and snippets.

@xxxzhi
xxxzhi / bugtrace.txt
Last active September 16, 2017 09:06
problem_test_code.py
Namespace(batch_size=10, ignore_label=0, input_size='228, 304', learning_rate=0.00025, model='model_joint4', momentum=0.9, num_classes=4, num_steps=15001, power=0.9, random_mirror=False, random_scale=False, random_seed=1234, restore_model=False, save_num_images=2, save_pred_every=1000, train_list='', weight_decay=0.0005)
begin test
Model size:3,600,248
Model size:7,209,840
2017-09-16 17:03:50.563408: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-16 17:03:50.563431: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-16 17:03:50.563439: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed
from PIL import Image
import numpy as np
import tensorflow as tf
def fre_iou(labels,
predictions,
num_classes,
weights=None,
metrics_collections=None,
@xxxzhi
xxxzhi / GenericTest.java
Created October 30, 2015 09:42
GenericTest
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.HashMap;
import java.util.Map;
public class GenericTest<T1,T2 extends Number> {
@xxxzhi
xxxzhi / OomExceptionHandler.java
Last active September 5, 2015 02:14 — forked from pyricau/OomExceptionHandler.java
Dump the heap on OutOfMemoryError crashes in your debug builds.
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@xxxzhi
xxxzhi / attr.java
Created January 15, 2015 06:48
From http://stackoverflow.com/questions/7896615/android-how-to-get-value-of-an-attribute-in-code using java to get attribute。 用java 代码去获取属性的值。
TypedValue typedValue = new TypedValue();
// ((Activity)context).getTheme().resolveAttribute(android.R.attr.textAppearanceLarge, typedValue, true);
int[] textSizeAttr = new int[] { android.R.attr.textSize };
int indexOfAttrTextSize = 0;
TypedArray a = context.obtainStyledAttributes(typedValue.data, textSizeAttr);
int textSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1);
a.recycle();
@xxxzhi
xxxzhi / android.mk
Created August 14, 2014 08:50
这是在cocos2d-x 中 使用下面这一部分能够自动包含 class 目录下面的源文件,以及 jni/ 下面的源文件。目录递归包含。摘自:http://blog.ready4go.com/blog/2013/10/12/update-android-dot-mk-with-local-src-files-and-local-c-includes/
# 配置自己的源文件目录和源文件后缀名
MY_FILES_PATH := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../Classes
MY_FILES_SUFFIX := %.cpp %.c
# 递归遍历目录下的所有的文件
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
# 获取相应的源文件
AAssetDir* assetDir = AAssetManager_openDir(mgr, "");
const char* filename = (const char*)NULL;
while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
AAsset* asset = AAssetManager_open(mgr, filename, AASSET_MODE_STREAMING);
char buf[BUFSIZ];
int nb_read = 0;
FILE* out = fopen(filename, "w");
while ((nb_read = AAsset_read(asset, buf, BUFSIZ)) > 0)
fwrite(buf, nb_read, 1, out);
fclose(out);
@xxxzhi
xxxzhi / SingleTraveralRandom.h
Created November 25, 2013 15:28
single traversal random algorithm
/*
* SingleTraveralRandom.h
*
* Created on: 2013年11月25日
* Author: houzhi
*/
#ifndef SINGLETRAVERALRANDOM_H_
#define SINGLETRAVERALRANDOM_H_
@xxxzhi
xxxzhi / SimpleAdapterDemo.java
Created November 17, 2013 10:28
From http://blog.csdn.net/u010142437/article/details/9059359 demo of SimpleAdapter SimpleAdapter 的使用案例
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
@xxxzhi
xxxzhi / new_gist_file.java
Created November 17, 2013 10:23
android obtain the drawable array 。 android 获取资源数组
TypedArray array = resources.obtainTypedArray(R.array.share_str);
Drawable drawable = array.getDrawable(0);