forked from whai362/PSENet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
62 lines (54 loc) · 1.3 KB
/
__init__.py
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
import log
import dtype
# import plt
import np
import img
_img = img
import dec
import rand
import mod
import proc
import test
import neighbour as nb
#import mask
import str_ as str
import io as sys_io
import io_ as io
import feature
import thread_ as thread
import caffe_ as caffe
# import tf
import cmd
import ml
import sys
import url
from .misc import *
from .logger import *
# log.init_logger('~/temp/log/log_' + get_date_str() + '.log')
def exit(code = 0):
sys.exit(0)
is_main = mod.is_main
init_logger = log.init_logger
def sit(img, path = None, name = ""):
if path is None:
_count = get_count();
path = '~/temp/no-use/images/%s_%d_%s.jpg'%(log.get_date_str(), _count, name)
if type(img) == list:
plt.show_images(images = img, path = path, show = False, axis_off = True, save = True)
else:
plt.imwrite(path, img)
return path
_count = 0;
def get_count():
global _count;
_count += 1;
return _count
def cit(img, path = None, rgb = True, name = ""):
_count = get_count();
if path is None:
img = np.np.asarray(img, dtype = np.np.uint8)
path = '~/temp/no-use/%s_%d_%s.jpg'%(log.get_date_str(), _count, name)
_img.imwrite(path, img, rgb = rgb)
return path
def argv(index):
return sys.argv[index]