Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] PERCEPTION: scan the code and totem colors #345

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions perception/navigator_vision/config/stc/datasets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Defines one labeling project
datasets:
- name: navigator_stc_seecam
sources:
- file: 2018-02-18/stc.bag # bag file name. Will be resolved relative to bag dir set in yaml of cli argument
topic: /camera/seecam/image_raw # Topic in bag to extract images from
encoding: rect_color # How to process image if needed, can be mono, rect, color, or rect_color
freq: 0.5 # Number of images to extract per second of bag time
- file: 2018-02-04/stc_closer.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-04/scanthecode.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.05
- file: 2018-02-18/stc2.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
1 change: 1 addition & 0 deletions perception/navigator_vision/config/stc/labels.json

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions perception/navigator_vision/config/stc/training.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
,Class,B,G,R,H,S,V,L,A,B
0,2,169,198,134,76,82,198,191,101,136
1,3,246,115,132,124,136,246,143,167,64
2,1,138,125,197,175,93,197,154,158,133
3,4,173,189,201,17,36,201,197,130,138
4,2,172,201,135,77,84,201,194,101,136
5,2,171,200,132,77,87,200,193,100,136
6,0,142,127,130,126,27,142,138,132,120
7,0,141,126,129,126,27,141,137,132,120
8,4,169,204,200,33,44,204,207,121,145
9,1,110,121,209,3,121,209,154,161,149
10,3,248,115,105,118,147,248,138,162,60
11,1,109,122,210,4,123,210,155,161,150
12,3,246,112,103,118,148,246,135,163,60
13,1,109,120,210,3,123,210,153,162,149
14,3,250,109,100,118,153,250,134,166,56
15,1,112,125,206,4,116,206,155,158,148
16,3,248,110,102,118,150,248,134,165,58
17,1,107,118,210,3,125,210,152,163,150
18,3,246,112,103,118,148,246,135,163,60
19,3,250,109,98,118,155,250,134,165,56
20,4,167,199,197,32,41,199,202,122,144
21,2,145,182,113,74,97,182,176,98,140
22,0,139,113,115,122,48,139,124,135,114
23,2,143,178,113,74,93,178,172,99,139
24,0,138,113,115,122,46,138,124,134,115
25,2,148,177,117,76,86,177,172,102,137
26,0,141,116,118,122,45,141,127,134,115
27,2,151,181,119,75,87,181,176,101,137
28,0,140,114,116,122,47,140,125,134,114
29,4,135,156,173,17,56,173,167,131,141
30,0,140,114,116,122,47,140,125,134,114
31,4,134,151,165,16,48,165,161,130,139
32,0,141,115,117,122,47,141,126,134,114
33,4,134,156,171,18,55,171,166,130,142
34,0,141,115,117,122,47,141,126,134,114
35,4,136,160,177,18,59,177,170,130,143
36,0,140,114,116,122,47,140,125,134,114
37,4,134,154,170,17,54,170,165,131,141
38,0,141,115,117,122,47,141,126,134,114
39,4,134,156,173,17,57,173,167,131,142
40,4,133,158,174,18,60,174,168,130,143
41,4,129,150,164,18,54,164,160,130,141
42,4,136,154,168,17,49,168,164,130,139
43,4,135,154,169,17,51,169,164,130,140
44,4,129,159,174,20,66,174,168,129,146
45,4,134,159,175,18,60,175,169,130,143
46,4,132,154,171,17,58,171,165,131,142
68 changes: 68 additions & 0 deletions perception/navigator_vision/config/totems_color/datasets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Defines one labeling project
datasets:
- name: navigator_totems_color_seecam
sources:
- file: 2018-02-18/blue_totem_bright.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-18/red_totem_bright.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-18/yellow_totem_bright.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-18/white_totem_bright.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-03-18/greentotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.2
- file: 2018-03-18/redtotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 2.0
- file: 2018-03-18/whitetotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.25
- file: 2018-02-04/greentotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.2
- file: 2018-02-04/bluetotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.3
- file: 2018-02-04/blue_totem_cloudy.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.8
- file: 2018-02-04/green_totem_cloudy.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-04/red_totem_cloudy.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.5
- file: 2018-02-04/yellow_totem_cloudy.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.75
- file: 2018-02-04/yellowtotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.3
- file: 2018-02-04/white_totem_cloudy.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.75
- file: 2018-02-04/whitetotem.bag
topic: /camera/seecam/image_raw
encoding: rect_color
freq: 0.75

Large diffs are not rendered by default.

133 changes: 133 additions & 0 deletions perception/navigator_vision/config/totems_color/training.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
,Class,B,G,R,H,S,V,L,A,B
0,0,207,217,223,19,18,223,222,128,134
1,4,94,184,211,23,141,211,192,127,177
2,0,209,205,211,160,7,211,212,131,127
3,0,210,221,228,18,20,228,226,129,134
4,4,90,185,212,23,147,212,193,126,179
5,0,206,200,205,145,7,206,207,131,126
6,0,208,221,227,21,21,227,225,128,135
7,4,90,187,215,23,148,215,195,126,180
8,1,87,93,194,2,141,194,132,168,151
9,3,208,131,109,113,121,208,143,141,86
10,0,213,225,231,20,20,231,229,128,135
11,4,87,177,203,23,146,203,186,126,177
12,1,85,90,194,1,143,194,131,169,151
13,0,210,220,226,19,18,226,225,128,134
14,4,97,189,218,23,142,218,197,127,178
15,1,83,89,194,2,146,194,130,170,152
16,0,211,221,228,18,19,228,226,129,134
17,4,85,180,208,23,151,208,189,127,179
18,1,84,89,190,1,142,190,129,168,150
19,0,216,228,233,21,19,233,231,128,134
20,1,76,81,168,2,140,168,116,163,148
21,1,81,89,188,2,145,188,128,167,152
22,3,186,127,107,112,108,186,138,136,95
23,0,207,219,225,20,20,225,223,128,135
24,1,78,83,167,2,136,167,116,162,147
25,2,115,195,128,55,105,195,186,91,162
26,0,209,221,226,21,19,226,225,128,135
27,1,86,89,169,1,125,169,121,160,145
28,2,118,203,130,56,107,203,192,89,163
29,0,210,222,227,21,19,227,226,128,134
30,1,82,86,170,1,132,170,119,162,146
31,2,118,198,130,56,103,198,188,91,161
32,0,211,224,229,22,20,229,228,128,135
33,1,84,88,171,1,130,171,121,162,146
34,2,116,193,127,56,102,193,184,92,160
35,0,214,226,230,23,18,230,229,127,134
36,2,75,134,88,53,112,134,131,101,155
37,2,116,191,125,56,100,191,182,92,159
38,0,211,223,228,21,19,228,227,128,134
39,2,77,134,89,54,108,134,131,101,154
40,0,146,149,157,8,18,157,159,130,131
41,0,208,219,224,21,18,224,223,128,134
42,2,81,135,93,53,102,135,133,103,152
43,0,147,150,159,8,19,159,160,131,131
44,0,210,223,228,22,20,228,227,128,135
45,2,75,133,88,53,111,133,130,101,154
46,0,147,150,159,8,19,159,160,131,131
47,0,213,226,232,21,21,232,230,128,135
48,2,79,135,92,53,106,135,133,102,153
49,0,148,151,160,8,19,160,161,131,131
50,0,204,218,224,21,23,224,222,128,136
51,2,76,134,89,53,110,134,131,101,155
52,0,150,150,158,0,13,158,160,131,129
53,0,211,224,229,22,20,229,228,128,135
54,2,74,136,88,53,116,136,133,99,156
55,4,67,221,233,28,182,233,221,115,201
56,0,211,224,230,21,21,230,228,128,135
57,2,70,134,84,53,122,134,130,98,157
58,0,205,219,224,22,22,224,223,127,136
59,4,65,225,237,28,185,237,225,115,203
60,3,150,92,77,114,124,150,103,139,94
61,0,207,220,225,22,20,225,224,127,135
62,1,29,45,156,4,208,156,92,173,164
63,3,149,93,77,113,123,149,103,138,95
64,0,211,224,229,22,20,229,228,128,135
65,1,27,43,154,4,210,154,90,173,164
66,3,154,96,82,114,119,154,107,139,95
67,0,207,220,226,21,21,226,224,128,135
68,1,28,44,155,4,209,155,91,173,164
69,3,149,97,83,114,113,149,107,137,98
70,0,207,220,225,22,20,225,224,127,135
71,1,27,48,156,5,211,156,93,172,165
72,3,153,95,81,114,120,153,106,139,94
73,0,207,220,226,21,21,226,224,128,135
74,3,153,97,83,114,117,153,108,138,96
75,1,26,50,158,5,213,158,95,172,167
76,0,209,220,226,19,19,226,224,128,134
77,3,157,100,86,114,115,157,111,138,95
78,3,192,108,87,114,139,192,122,145,81
79,0,191,187,194,163,9,194,195,131,127
80,3,154,98,84,114,116,154,109,138,96
81,3,191,106,86,114,140,191,120,146,81
82,0,190,186,193,163,9,193,194,131,127
83,3,153,97,82,114,118,153,108,138,96
84,3,191,106,85,114,142,191,120,145,81
85,0,194,190,197,163,9,197,198,131,127
86,3,154,96,81,114,121,154,107,139,95
87,3,191,106,86,114,140,191,120,146,81
88,0,191,187,193,160,8,193,195,131,127
89,3,118,77,69,115,106,118,86,137,103
90,0,190,187,193,165,8,193,195,131,127
91,3,116,75,67,115,108,116,84,136,103
92,0,187,184,190,165,8,190,192,131,127
93,3,117,77,69,115,105,117,86,136,104
94,0,190,186,192,160,8,192,194,131,127
95,1,66,67,104,1,93,104,83,144,135
96,3,116,76,69,116,103,116,85,136,104
97,4,41,136,162,24,190,162,147,128,180
98,3,126,88,82,116,89,126,98,135,106
99,3,38,134,161,23,195,161,145,128,180
100,3,135,105,103,118,60,135,116,134,111
101,4,44,132,160,23,185,160,144,129,177
102,3,134,109,108,119,49,134,119,133,114
103,4,40,133,161,23,192,161,144,129,179
104,1,76,79,127,2,102,127,99,148,138
105,3,133,107,105,118,54,133,117,133,113
106,3,36,129,157,23,197,157,141,129,179
107,3,118,81,74,115,95,118,90,135,106
108,4,36,135,161,24,198,161,146,128,181
109,3,123,83,75,115,100,123,92,135,104
110,4,36,135,161,24,198,161,146,128,181
111,2,88,162,114,49,116,162,158,98,161
112,4,42,133,159,23,188,159,144,128,178
113,2,93,165,118,50,111,165,161,99,160
114,4,40,129,154,23,189,154,140,128,177
115,2,91,167,119,49,116,167,162,98,162
116,4,37,125,145,24,190,145,135,126,176
117,2,93,169,122,49,115,169,164,98,162
118,2,93,168,121,49,114,168,163,98,162
119,4,42,115,130,25,173,130,124,125,169
120,2,89,161,118,48,114,161,157,100,161
121,4,77,180,207,24,160,207,188,126,183
122,4,91,188,215,23,147,215,196,126,180
123,2,93,162,124,47,109,162,159,102,160
124,0,222,214,225,158,12,225,221,133,125
125,4,86,184,211,24,151,211,192,126,180
126,0,227,218,231,159,14,231,225,134,125
127,4,83,182,207,24,153,207,190,125,181
128,0,222,214,225,158,12,225,221,133,125
129,4,86,184,210,24,151,210,192,126,180
130,0,226,219,228,157,10,228,225,132,126
131,4,82,183,210,24,155,210,191,126,182
2 changes: 2 additions & 0 deletions perception/navigator_vision/navigator_vision/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from scan_the_code_classifier import ScanTheCodeClassifier
from totems_color_classifier import TotemsColorClassifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
from mil_vision_tools import GaussianColorClassifier
from rospkg import RosPack
import os


class ScanTheCodeClassifier(GaussianColorClassifier):
CLASSES = ['stc_off', 'stc_red', 'stc_green', 'stc_blue', 'stc_yellow']

def __init__(self):
rospack = RosPack()
path = rospack.get_path('navigator_vision')
training_file = os.path.join(path, 'config/stc/training.csv')
labelfile = os.path.join(path, 'config/stc/labels.json')
super(ScanTheCodeClassifier, self).__init__(ScanTheCodeClassifier.CLASSES,
training_file=training_file, labelfile=labelfile)


if __name__ == '__main__':
'''
Can be run as executable to extract features or check accuracy score
'''
import sys
s = ScanTheCodeClassifier()
s.main(sys.argv[1:])
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
from mil_vision_tools import GaussianColorClassifier
from rospkg import RosPack
import os


class TotemsColorClassifier(GaussianColorClassifier):
CLASSES = ['{}_totem'.format(color) for color in ['white', 'red', 'green', 'blue', 'yellow']]

def __init__(self):
rospack = RosPack()
path = rospack.get_path('navigator_vision')
training_file = os.path.join(path, 'config/totems_color/training.csv')
labelfile = os.path.join(path, 'config/totems_color/labels.json')
super(TotemsColorClassifier, self).__init__(self.CLASSES,
training_file=training_file, labelfile=labelfile)


if __name__ == '__main__':
'''
Can be run as executable to extract features or check accuracy score
'''
import sys
c = TotemsColorClassifier()
c.main(sys.argv[1:])
Loading