-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCAN THE CODE: refactor classifier using base class main function
- Loading branch information
1 parent
e03f75a
commit 1b2accd
Showing
5 changed files
with
31 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
perception/navigator_vision/navigator_vision/totems_color_classifier.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:]) |