小行星

热爱平淡,向往未知


  • 首页

  • 分类

  • 归档

  • 关于

  • 阅读排行

  • 搜索

git 下载所有branch

发表于 2018-09-Fri | 阅读次数:
1
2
3
for branch in `git branch -a | sed -n '\=/HEAD$=d; \=/master$=d;s= remotes/==p'`; do 
git branch --track ${branch##*/} $branch
done

git stash使用

发表于 2018-09-Thu | 阅读次数:

git stash 把commit放入到一个list里面

git apply 可以多次使用

git pop 只能使用一次

git 放弃本地修改

发表于 2018-09-Thu | 阅读次数:
1
git checkout . && git clean -df

git 回退远程commit

发表于 2018-09-Thu | 阅读次数:
1
2
3
4
5
git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master

pytorch tensor类型转换

发表于 2018-09-Wed | 阅读次数:
1
a.int() # in place op

图像中的h,w 和 keypoint xy

发表于 2018-09-Tue | 分类于 长文 | 阅读次数:

读入是h, w;

x y 又是/w /h;

然后索引的时候又是y x mask[bdx, 0, miny: maxy+1, minx: maxx+1] = 1

为了避免下次再遇到这个错误,一律使用w1, h1。

plot.py

发表于 2018-09-Tue | 阅读次数:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import json
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as matio
import os
import cv2
import torch
import matplotlib.patches as mpatches
from skimage import io


def load_mat(path):
with open(path) as f:
mat = matio.loadmat(f)
return mat

def create_patch(pos):
xy = (pos[0], pos[1])
w = pos[2] - pos[0]
h = pos[3] - pos[1]
return mpatches.Rectangle(xy, w, h, alpha=0.7)

def create_circle(xy):
x = xy[0]
y = xy[1]
return mpatches.Circle((x,y), radius=5)

def rescale_bbox(bbox):
midx = (bbox[0] + bbox[2]) / 2.0
midy = (bbox[1] + bbox[3]) / 2.0
w = bbox[2] - bbox[0]
h = bbox[3] - bbox[1]
s = 1.25
w *= s
h *= s
return [midx - w / 2.0, midy - h / 2.0,
midx + w / 2.0, midy + h / 2.0]

def revert_img(img):
mean=[0.485, 0.456, 0.406]
std=[0.229, 0.224, 0.225]
img = img * std + mean
img *= 255
img = np.clip(img, 0, 255)
return img

def get_max(a1, a2):
return max(np.max(a1), np.max(a2))

def get_min(a1, a2):
return min(np.min(a1), np.min(a2))

fig, ax1 = plt.subplots(figsize=(6,6))
ax1.imshow(heatmap)
p1 = create_patch(p_bbox)
p2 = create_patch(p_corner)
ax1.add_patch(p1)
ax1.add_patch(p2)

fig, ax2 = plt.subplots(figsize=(6,6))
ax2.imshow(heatmap)
c1 = create_circle([p1x, p1y])
c2 = create_circle([p2x, p2y])
ax2.add_patch(c1)
ax2.add_patch(c2)

plt画灰度图

发表于 2018-09-Mon | 阅读次数:
1
2
3
plt.imshow(img, cmap ='gray')
plt.imshow(img, cmap = plt.cm.gray)
plt.imshow(img, cmap = plt.cm.gray_r)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xab in position 133: invalid start byte

发表于 2018-09-Mon | 阅读次数:
1
2
with open(path, 'rb') as f:
contents = f.read()

list无法变成numpy

发表于 2018-09-Sun | 阅读次数:

原因是list的shape不一样

1…121314…59
fangyh

fangyh

最爱的是那苍穹之外的浩渺宇宙

588 日志
4 分类
66 标签
© 2020 fangyh
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.3
|本站总访问量次