Blame view

test/test_data.py 3.4 KB
0d9a20ea   Chunk   staged.
1
2
__author__ = 'chunk'

2c2d57c7   Chunk   ILSVRC datapath h...
3
from ..common import *
be12257b   Chunk   data-feat-model f...
4

84648488   Chunk   reverted.
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
from ..mdata import ILSVRC, ILSVRC_S


def test_ILSVRC(category='Train_100'):
    timer = Timer()

    # dil = ILSVRC.DataILSVRC(base='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val', category='Train')
    dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val',
                            category=category)
    # dil = ILSVRC.DataILSVRC(base='/media/chunk/Elements/D/data/ImageNet/img/ILSVRC2013_DET_val', category='Train_1')
    print '[time]category:', category

    timer.mark()
    print '[time]formatting...'
    dil.format()
    timer.report()

    timer.mark()
    print '[time]embedding...'
    dil.embed(rate=0.2)
    timer.report()

    timer.mark()
    print '[time]extracting...'
    dil.extract_feat(feattype='ibd')
    timer.report()
be12257b   Chunk   data-feat-model f...
31

24b3b616   Chunk   staged.
32
    # dil.extract_feat(feattype='hog')
1821e0e3   Chunk   benchmarking...
33

554a7b9a   Chunk   staged.
34
    # timer.mark()
1821e0e3   Chunk   benchmarking...
35
    # dil.store_img()
1dc7c44b   Chunk   crawler-hbase-spa...
36
    # timer.report()
84648488   Chunk   reverted.
37

1dc7c44b   Chunk   crawler-hbase-spa...
38
    # timer.mark()
1821e0e3   Chunk   benchmarking...
39
    # dil.store_tag()
554a7b9a   Chunk   staged.
40
    # timer.report()
02528074   Chunk   staged.
41
    #
1821e0e3   Chunk   benchmarking...
42
    # timer.mark()
ad70caf6   Chunk   staged.
43
    # dil.store_info()
02528074   Chunk   staged.
44
45
46
    # timer.report()
    #
    # timer.mark()
1821e0e3   Chunk   benchmarking...
47
    # dil.store_feat()
02528074   Chunk   staged.
48
49
    # timer.report()

2c2d57c7   Chunk   ILSVRC datapath h...
50

554a7b9a   Chunk   staged.
51
def test_ILSVRC_S_LOCAL():
1821e0e3   Chunk   benchmarking...
52
    timer = Timer()
02528074   Chunk   staged.
53

554a7b9a   Chunk   staged.
54
    timer.mark()
489c5608   Chunk   debugging...
55
    dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val',
02528074   Chunk   staged.
56
57
                            category='Train_2')
    dil.delete_table()
4f36b116   Chunk   staged.
58
59
60
    dil.format()
    dil.store_img()
    timer.report()
ad70caf6   Chunk   staged.
61

4f36b116   Chunk   staged.
62
63
64
65
66
67
68
69
70
71
72
    dils = ILSVRC_S.DataILSVRC_S(base='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val',
                                 category='Train_2')

    # dils._extract_data(mode='hbase', writeback=True)
    # dils._embed_data(mode='hbase', rate=0.1, readforward=True, writeback=True)
    # dils._extract_feat( mode='hbase', feattype='ibd', readforward=True, writeback=True)

    dils._extract_data(mode='hbase', writeback=False)
    dils._embed_data(mode='hbase', rate=0.1, readforward=False, writeback=False)
    dils._extract_feat(mode='hbase', feattype='ibd', readforward=False, writeback=True)

554a7b9a   Chunk   staged.
73
    timer.report()
cb798a7f   Chunk   libs & scripts in...
74

1dc7c44b   Chunk   crawler-hbase-spa...
75

24768a99   Chunk   mode 'hbase' fini...
76
def test_ILSVRC_S_SPARK(category='Train_1000'):
35cf2e3a   Chunk   staged.
77
    timer = Timer()
1dc7c44b   Chunk   crawler-hbase-spa...
78

84648488   Chunk   reverted.
79
    timer.mark()
d47ae6ce   Chunk   staged.
80
81
82
    dil = ILSVRC.DataILSVRC(base_dir='/data/hadoop/ImageNet/ILSVRC/ILSVRC2013_DET_val',
                            category=category)
    dil.delete_table()
1dc7c44b   Chunk   crawler-hbase-spa...
83
    dil.format()
35cf2e3a   Chunk   staged.
84
    dil.store_img()
84648488   Chunk   reverted.
85
    timer.report()
35cf2e3a   Chunk   staged.
86
    # return
35cf2e3a   Chunk   staged.
87

1dc7c44b   Chunk   crawler-hbase-spa...
88
89
90
91
92
93
94
95
96
97
    dils = ILSVRC_S.DataILSVRC_S(base='ILSVRC2013_DET_val', category=category)

    timer.mark()
    dils._extract_data(mode='spark', writeback=False)
    timer.report()

    # print dils.rdd_data.count() # pass
    # return

    timer.mark()
26616791   Chunk   RDD-hbase bug fix...
98
    dils._embed_data(mode='spark', rate=0.2, readforward=False, writeback=False)
1dc7c44b   Chunk   crawler-hbase-spa...
99
100
    timer.report()

54e2adda   Chunk   staged.
101
    timer.mark()
84648488   Chunk   reverted.
102
    dils._extract_feat(mode='spark', feattype='ibd', readforward=False, writeback=True,
54e2adda   Chunk   staged.
103
                       withdata=True)
f4fb4381   Chunk   staged.
104
    timer.report()
54e2adda   Chunk   staged.
105
106


26616791   Chunk   RDD-hbase bug fix...
107
def test_ILSVRC_S():
489c5608   Chunk   debugging...
108
    # test_ILSVRC_S_LOCAL()
1821e0e3   Chunk   benchmarking...
109
    test_ILSVRC_S_SPARK()
489c5608   Chunk   debugging...
110

1dc7c44b   Chunk   crawler-hbase-spa...
111

489c5608   Chunk   debugging...
112
def test_pipeline():
489c5608   Chunk   debugging...
113
    timer = Timer()
84648488   Chunk   reverted.
114

1dc7c44b   Chunk   crawler-hbase-spa...
115
116
    timer.mark()

b9990e77   Chunk   staged.
117
    dils = ILSVRC_S.DataILSVRC_S(base='MSPIDER', category=None)
4f36b116   Chunk   staged.
118

e3e7e73a   Chunk   spider standalone...
119
120
    dils._extract_data(mode='spark', writeback=False)
    dils._embed_data(mode='spark', rate=0.1, readforward=False, writeback=False)
e3ec1f74   Chunk   staged.
121
122
123
    dils._extract_feat(mode='spark', feattype='ibd', readforward=False, writeback=True,
                       withdata=True)

f4fb4381   Chunk   staged.
124
    timer.report()
e3ec1f74   Chunk   staged.
125
126
127


if __name__ == '__main__':
e3e7e73a   Chunk   spider standalone...
128
    # test_MSR()
4f36b116   Chunk   staged.
129
130
131
132
133
134
135
    # test_CV()
    # test_ILSVRC()
    # test_ILSVRC_S()

    test_pipeline()

    print 'helllo'
e3e7e73a   Chunk   spider standalone...

e3e7e73a   Chunk   spider standalone...

f4fb4381   Chunk   staged.

e3e7e73a   Chunk   spider standalone...

1dc7c44b   Chunk   crawler-hbase-spa...

4f36b116   Chunk   staged.

1dc7c44b   Chunk   crawler-hbase-spa...

84648488   Chunk   reverted.

1dc7c44b   Chunk   crawler-hbase-spa...

3b4e250d   Chunk   staged.

2c2d57c7   Chunk   ILSVRC datapath h...

84648488   Chunk   reverted.

51708346   Chunk   final experiments...

84648488   Chunk   reverted.

4f36b116   Chunk   staged.

84648488   Chunk   reverted.

24b3b616   Chunk   staged.

be12257b   Chunk   data-feat-model f...

2c2d57c7   Chunk   ILSVRC datapath h...

0fbc087e   Chunk   staged.

1dc7c44b   Chunk   crawler-hbase-spa...

0fbc087e   Chunk   staged.

1dc7c44b   Chunk   crawler-hbase-spa...

be12257b   Chunk   data-feat-model f...

be12257b   Chunk   data-feat-model f...