Пример #1
0
    def save_data(self, name, metadata=True, angle=None):
        dict = {
            'laserscans': self.laserscans,
            'l1': self.config.thok_l1,
            'l2': self.config.thok_l2,
            'image_angle': angle
        }

        prefix = self.config.path + '/data/' + name
        print "Saving: " + prefix + '_laserscans.pkl'
        ut.save_pickle(dict, prefix + '_laserscans.pkl')
        print "Saving: " + prefix + '_image.png'
        highgui.cvSaveImage(prefix + '_image.png', self.img)

        if metadata:
            # save metadata to database:
            database = scans_database.scans_database()
            database.load(self.config.path, 'database.pkl')
            dataset = scan_dataset.scan_dataset()
            dataset.id = name
            dataset.scan_filename = 'data/' + name + '_laserscans.pkl'
            dataset.image_filename = 'data/' + name + '_image.png'
            database.add_dataset(dataset)
            database.save()

        return name
Пример #2
0
 def save_data(self,name, metadata=True, angle = None):
     dict = {'laserscans' : self.laserscans,
         'l1': self.config.thok_l1, 'l2': self.config.thok_l2,
         'image_angle' : angle} 
     
     prefix = self.config.path+'/data/'+name
     print "Saving: "+prefix+'_laserscans.pkl'
     ut.save_pickle(dict,prefix+'_laserscans.pkl')
     print "Saving: "+prefix+'_image.png'
     highgui.cvSaveImage(prefix+'_image.png',self.img)
     
     if metadata:
         # save metadata to database:
         database = scans_database.scans_database()
         database.load(self.config.path,'database.pkl')
         dataset = scan_dataset.scan_dataset()
         dataset.id = name
         dataset.scan_filename = 'data/'+name+'_laserscans.pkl'
         dataset.image_filename = 'data/'+name+'_image.png'
         database.add_dataset(dataset)
         database.save()
     
     return name
Пример #3
0
    def __init__(self, path, parent=None):
        
        self.init_in_progress = True
        
        self.path = path
        
        # load configs for taking scans, etc:
        self.config = configuration.configuration(path)
        #create scanner and processor when needed:
        self.scanner = False
        self.processor = False
        
        # load database:
        self.scans_database = scans_database.scans_database()
        self.scans_database.load(path,'database.pkl')
        
        #get first dataset:
        self.current_dataset = self.scans_database.get_dataset(0)

        QtGui.QWidget.__init__(self, parent)
        self.setWindowTitle('labeling tool')
        

        left_layout = QtGui.QVBoxLayout()
        self.draw_widget = draw_widget(self.current_dataset.polygons, self.scans_database.get_path() + '/' + self.current_dataset.image_filename, self)
        
        title_layout = QtGui.QHBoxLayout()
        
        take_scan_button = QtGui.QPushButton('Scan')
        take_scan_button.setMaximumWidth(50)
        title_layout.addWidget(take_scan_button)
        self.connect(take_scan_button, QtCore.SIGNAL('clicked()'), self.slot_take_scan )      
        
        take_artag_image_button = QtGui.QPushButton('ARTag')
        take_artag_image_button.setMaximumWidth(50)
        title_layout.addWidget(take_artag_image_button)
        self.connect(take_artag_image_button, QtCore.SIGNAL('clicked()'), self.slot_take_artag_image )              
        
        button = QtGui.QPushButton('Import Img')
        title_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_import_image )                 
        
        label = QtGui.QLabel("View: ")
        title_layout.addWidget(label)
        self.display_3d_button = QtGui.QPushButton('3D')
        self.display_3d_button.setMaximumWidth(40)
        title_layout.addWidget(self.display_3d_button)
        self.connect(self.display_3d_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d )
        
        combobox = QtGui.QComboBox()
        combobox.addItem("Height", QtCore.QVariant("height"))
        combobox.addItem("Intensities", QtCore.QVariant("intensities"))
        #combobox.addItem("objects", QtCore.QVariant("objects"))
        combobox.addItem("Labels", QtCore.QVariant("labels"))
        combobox.addItem("Classifier range", QtCore.QVariant("range"))
        combobox.addItem("Classifier color", QtCore.QVariant("color"))
        combobox.addItem("Classifier all", QtCore.QVariant("all"))
        combobox.addItem("Classifier all+post", QtCore.QVariant("all_post"))
        combobox.addItem("Baseline algo", QtCore.QVariant("baseline"))
        combobox.addItem("h", QtCore.QVariant("h"))
        combobox.addItem("s", QtCore.QVariant("s"))
        combobox.addItem("v", QtCore.QVariant("v"))
        self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_display_3d_type)  
        title_layout.addWidget(combobox)
        self.display_3d_type_combobox = combobox;        
        
        
        self.display_3d_spheres_button = QtGui.QPushButton('3D_Spheres')
        title_layout.addWidget(self.display_3d_spheres_button)
        self.connect(self.display_3d_spheres_button, QtCore.SIGNAL('clicked()'), self.slot_display_3d_spheres )                  
        self.display_intensity_button = QtGui.QPushButton('Intensity')
        self.display_intensity_button.setMaximumWidth(50)
        title_layout.addWidget(self.display_intensity_button)
        self.connect(self.display_intensity_button, QtCore.SIGNAL('clicked()'), self.slot_display_intensity )   
        self.display_features_button = QtGui.QPushButton('Features')
        title_layout.addWidget(self.display_features_button)
        self.display_features_button.setMaximumWidth(50)
        self.connect(self.display_features_button, QtCore.SIGNAL('clicked()'), self.slot_display_features )   
        self.display_labels_button = QtGui.QPushButton('Labels')
        title_layout.addWidget(self.display_labels_button)
        self.display_labels_button.setMaximumWidth(50)
        self.connect(self.display_labels_button, QtCore.SIGNAL('clicked()'), self.slot_display_labels )   
        self.display_stats_button = QtGui.QPushButton('Stats')
        title_layout.addWidget(self.display_stats_button)
        self.display_stats_button.setMaximumWidth(50)
        self.connect(self.display_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_stats )   
        self.display_global_stats_button = QtGui.QPushButton('Global Stats')
        title_layout.addWidget(self.display_global_stats_button)
        self.display_global_stats_button.setMaximumWidth(50)
        self.connect(self.display_global_stats_button, QtCore.SIGNAL('clicked()'), self.slot_display_global_stats )         
        
        self.line_edits = []
    
        self.add_line_edit('Title:',title_layout,'title')


        first_dataset_button = QtGui.QPushButton('<<')
        first_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(first_dataset_button)
        self.connect(first_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_first_dataset )
        prev_dataset_button = QtGui.QPushButton('<')
        prev_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(prev_dataset_button)
        self.connect(prev_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_prev_dataset )
        next_dataset_button = QtGui.QPushButton('>')
        next_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(next_dataset_button)
        self.connect(next_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_next_dataset )
        last_dataset_button = QtGui.QPushButton('>>')
        last_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(last_dataset_button)
        self.connect(last_dataset_button, QtCore.SIGNAL('clicked()'), self.slot_last_dataset )        
        
        save_button = QtGui.QPushButton('Save')
        title_layout.addWidget(save_button)
        save_button.setMaximumWidth(50)
        self.connect(save_button, QtCore.SIGNAL('clicked()'), self.slot_save )
        
        delete_button = QtGui.QPushButton('Delete')
        title_layout.addWidget(delete_button)
        delete_button.setMaximumWidth(50)
        self.connect(delete_button, QtCore.SIGNAL('clicked()'), self.slot_delete )        
        
        
        self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyChanged'), self.slot_update_polygons)
        self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyLabelChanged'), self.slot_update_polygon_label)
        self.connect(self.draw_widget, QtCore.SIGNAL('sigDefineGroundPlane'), self.slot_define_ground_plane)

        left_layout.addLayout(title_layout)
        
        #second row:
        row2_layout = QtGui.QHBoxLayout()
        left_layout.addLayout(row2_layout)
        

        label = QtGui.QLabel("Id:")
        row2_layout.addWidget(label)        
        self.id_label = QtGui.QLabel("")
        row2_layout.addWidget(self.id_label)        
        
        self.add_line_edit('Surface: ID:',row2_layout,'surface_id')
        self.add_line_edit('Height',row2_layout,'surface_height')
        
        
        label = QtGui.QLabel("Type: ")
        row2_layout.addWidget(label)
        combobox = QtGui.QComboBox()
        combobox.addItem("Table Office", QtCore.QVariant("table_office"))
        combobox.addItem("Table Dorm", QtCore.QVariant("table_dorm"))
        combobox.addItem("Table House", QtCore.QVariant("table_house"))
        combobox.addItem("Shelf Office", QtCore.QVariant("shelf_office"))
        combobox.addItem("Shelf Dorm", QtCore.QVariant("shelf_dorm"))
        combobox.addItem("Shelf House", QtCore.QVariant("shelf_house"))
        self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'), self.slot_update_surface_type)  
        row2_layout.addWidget(combobox)
        self.surface_type_combobox = combobox;
        
        self.add_line_edit('Camera: Height:',row2_layout,'camera_height')
        self.add_line_edit('Camera: Angle:',row2_layout,'camera_angle')
        
        #####################################
        #thrid row:
        row3_layout = QtGui.QHBoxLayout()
        left_layout.addLayout(row3_layout)
        
        #checkboxes:
        button = QtGui.QPushButton("&gen'n'save features")
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_generate_save_features )        
        
        checkbox = QtGui.QCheckBox('&Training Set')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_training_set)  
        self.checkbox_training_set = checkbox
        
        checkbox = QtGui.QCheckBox('Te&st Set')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_test_set)
        self.checkbox_test_set = checkbox  
        
        checkbox = QtGui.QCheckBox('Labels, Groundp. checked')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'), self.slot_update_is_labeled)
        self.checkbox_is_labeled = checkbox                         
        
        button = QtGui.QPushButton("Train'n'save Classifiers (training set)")
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_train_and_save_Classifiers )
        
        button = QtGui.QPushButton('Test Classifiers (on current)')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers )
        
        button = QtGui.QPushButton('Test Classifiers (on testset)')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_test_Classifiers_on_testset )        
        
        button = QtGui.QPushButton('Load Classifiers')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_load_Classifiers )
 
#        button = QtGui.QPushButton('Save Classifier')
#        row3_layout.addWidget(button)
#        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_save_Classifier )                       
        
        #####################################
        
        left_layout.addWidget(self.draw_widget)
        
        
        self.right_layout = QtGui.QVBoxLayout()
        self.right_layout.setAlignment(QtCore.Qt.AlignTop)
        
        self.outer_layout = QtGui.QHBoxLayout()
        self.outer_layout.addLayout(left_layout)
        self.outer_layout.addLayout(self.right_layout)
        

        
        self.polygon_comboboxes = []
        self.add_polygon_combobox()

        self.slot_update_polygons(self.current_dataset.polygons,0)
        
        
        self.setLayout(self.outer_layout)
        
        
        self.resize(900, 700) 
        self.load_values_from_dataset()
        
        self.init_in_progress = False
        
        #at startup, display newest:
        self.slot_last_dataset()
Пример #4
0
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import roslib
roslib.load_manifest('laser_camera_segmentation')
from labeling import label_object, scan_dataset, scans_database

scans_database = scans_database.scans_database()
scans_database.path = '/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling'
scans_database.filename = 'database.pkl'

dataset = scan_dataset.scan_dataset()
dataset.title = 'emtpy'
dataset.id = '0'
dataset.surface_id = '-1'
dataset.scan_filename = ''
dataset.image_filename = ''
scans_database.add_dataset(dataset)

#dataset = scan_dataset.scan_dataset()
#dataset.name = 'test2'
#dataset.scan_filename = ''
#dataset.image_filename = 'data/2009Oct01_112328_image.png'
Пример #5
0
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('laser_camera_segmentation')
from labeling import label_object, scan_dataset, scans_database



scans_database = scans_database.scans_database()
path = '/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling'
filename = 'database.pkl'
scans_database.load(path, filename)
scans_database.add_attribute_to_every_dataset('ransac_table_plane')

#dataset = scan_dataset.scan_dataset()
#dataset.name = 'test2'
#dataset.scan_filename = ''
#dataset.image_filename = 'data/2009Oct01_112328_image.png'
#scans_database.add_dataset(dataset)


scans_database.save()
Пример #6
0
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import roslib; roslib.load_manifest('laser_camera_segmentation')
from labeling import label_object, scan_dataset, scans_database

import copy

##WARNING! THIS DOES A PARTIAL COPY OF A DATABASE! BACKUP BEFOREHAND AND KNOW WHAT YOU'RE DOING!!##

path = '/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling'
f1 = 'database_changed.pkl'
db1 = scans_database.scans_database()
db1.load(path, f1)

f2 = 'database.pkl'
db2 = scans_database.scans_database()
db2.load(path, f2)

#assume db2 is equal or larger, copy changes from db1 to db2!
d2 = db2.get_first_dataset()
d1 = db1.get_first_dataset()
while False != d1:

    if False != d2 and d1.id == d2.id:
        print 'copy', d1.id
        d2.dict = copy.deepcopy(d1.dict)
        
Пример #7
0
    def __init__(self, path, parent=None):

        self.init_in_progress = True

        self.path = path

        # load configs for taking scans, etc:
        self.config = configuration.configuration(path)
        #create scanner and processor when needed:
        self.scanner = False
        self.processor = False

        # load database:
        self.scans_database = scans_database.scans_database()
        self.scans_database.load(path, 'database.pkl')

        #get first dataset:
        self.current_dataset = self.scans_database.get_dataset(0)

        QtGui.QWidget.__init__(self, parent)
        self.setWindowTitle('labeling tool')

        left_layout = QtGui.QVBoxLayout()
        self.draw_widget = draw_widget(
            self.current_dataset.polygons,
            self.scans_database.get_path() + '/' +
            self.current_dataset.image_filename, self)

        title_layout = QtGui.QHBoxLayout()

        take_scan_button = QtGui.QPushButton('Scan')
        take_scan_button.setMaximumWidth(50)
        title_layout.addWidget(take_scan_button)
        self.connect(take_scan_button, QtCore.SIGNAL('clicked()'),
                     self.slot_take_scan)

        take_artag_image_button = QtGui.QPushButton('ARTag')
        take_artag_image_button.setMaximumWidth(50)
        title_layout.addWidget(take_artag_image_button)
        self.connect(take_artag_image_button, QtCore.SIGNAL('clicked()'),
                     self.slot_take_artag_image)

        button = QtGui.QPushButton('Import Img')
        title_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_import_image)

        label = QtGui.QLabel("View: ")
        title_layout.addWidget(label)
        self.display_3d_button = QtGui.QPushButton('3D')
        self.display_3d_button.setMaximumWidth(40)
        title_layout.addWidget(self.display_3d_button)
        self.connect(self.display_3d_button, QtCore.SIGNAL('clicked()'),
                     self.slot_display_3d)

        combobox = QtGui.QComboBox()
        combobox.addItem("Height", QtCore.QVariant("height"))
        combobox.addItem("Intensities", QtCore.QVariant("intensities"))
        #combobox.addItem("objects", QtCore.QVariant("objects"))
        combobox.addItem("Labels", QtCore.QVariant("labels"))
        combobox.addItem("Classifier range", QtCore.QVariant("range"))
        combobox.addItem("Classifier color", QtCore.QVariant("color"))
        combobox.addItem("Classifier all", QtCore.QVariant("all"))
        combobox.addItem("Classifier all+post", QtCore.QVariant("all_post"))
        combobox.addItem("Baseline algo", QtCore.QVariant("baseline"))
        combobox.addItem("h", QtCore.QVariant("h"))
        combobox.addItem("s", QtCore.QVariant("s"))
        combobox.addItem("v", QtCore.QVariant("v"))
        self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'),
                     self.slot_update_display_3d_type)
        title_layout.addWidget(combobox)
        self.display_3d_type_combobox = combobox

        self.display_3d_spheres_button = QtGui.QPushButton('3D_Spheres')
        title_layout.addWidget(self.display_3d_spheres_button)
        self.connect(self.display_3d_spheres_button,
                     QtCore.SIGNAL('clicked()'), self.slot_display_3d_spheres)
        self.display_intensity_button = QtGui.QPushButton('Intensity')
        self.display_intensity_button.setMaximumWidth(50)
        title_layout.addWidget(self.display_intensity_button)
        self.connect(self.display_intensity_button, QtCore.SIGNAL('clicked()'),
                     self.slot_display_intensity)
        self.display_features_button = QtGui.QPushButton('Features')
        title_layout.addWidget(self.display_features_button)
        self.display_features_button.setMaximumWidth(50)
        self.connect(self.display_features_button, QtCore.SIGNAL('clicked()'),
                     self.slot_display_features)
        self.display_labels_button = QtGui.QPushButton('Labels')
        title_layout.addWidget(self.display_labels_button)
        self.display_labels_button.setMaximumWidth(50)
        self.connect(self.display_labels_button, QtCore.SIGNAL('clicked()'),
                     self.slot_display_labels)
        self.display_stats_button = QtGui.QPushButton('Stats')
        title_layout.addWidget(self.display_stats_button)
        self.display_stats_button.setMaximumWidth(50)
        self.connect(self.display_stats_button, QtCore.SIGNAL('clicked()'),
                     self.slot_display_stats)
        self.display_global_stats_button = QtGui.QPushButton('Global Stats')
        title_layout.addWidget(self.display_global_stats_button)
        self.display_global_stats_button.setMaximumWidth(50)
        self.connect(self.display_global_stats_button,
                     QtCore.SIGNAL('clicked()'),
                     self.slot_display_global_stats)

        self.line_edits = []

        self.add_line_edit('Title:', title_layout, 'title')

        first_dataset_button = QtGui.QPushButton('<<')
        first_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(first_dataset_button)
        self.connect(first_dataset_button, QtCore.SIGNAL('clicked()'),
                     self.slot_first_dataset)
        prev_dataset_button = QtGui.QPushButton('<')
        prev_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(prev_dataset_button)
        self.connect(prev_dataset_button, QtCore.SIGNAL('clicked()'),
                     self.slot_prev_dataset)
        next_dataset_button = QtGui.QPushButton('>')
        next_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(next_dataset_button)
        self.connect(next_dataset_button, QtCore.SIGNAL('clicked()'),
                     self.slot_next_dataset)
        last_dataset_button = QtGui.QPushButton('>>')
        last_dataset_button.setMaximumWidth(30)
        title_layout.addWidget(last_dataset_button)
        self.connect(last_dataset_button, QtCore.SIGNAL('clicked()'),
                     self.slot_last_dataset)

        save_button = QtGui.QPushButton('Save')
        title_layout.addWidget(save_button)
        save_button.setMaximumWidth(50)
        self.connect(save_button, QtCore.SIGNAL('clicked()'), self.slot_save)

        delete_button = QtGui.QPushButton('Delete')
        title_layout.addWidget(delete_button)
        delete_button.setMaximumWidth(50)
        self.connect(delete_button, QtCore.SIGNAL('clicked()'),
                     self.slot_delete)

        self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyChanged'),
                     self.slot_update_polygons)
        self.connect(self.draw_widget, QtCore.SIGNAL('sigPolyLabelChanged'),
                     self.slot_update_polygon_label)
        self.connect(self.draw_widget, QtCore.SIGNAL('sigDefineGroundPlane'),
                     self.slot_define_ground_plane)

        left_layout.addLayout(title_layout)

        #second row:
        row2_layout = QtGui.QHBoxLayout()
        left_layout.addLayout(row2_layout)

        label = QtGui.QLabel("Id:")
        row2_layout.addWidget(label)
        self.id_label = QtGui.QLabel("")
        row2_layout.addWidget(self.id_label)

        self.add_line_edit('Surface: ID:', row2_layout, 'surface_id')
        self.add_line_edit('Height', row2_layout, 'surface_height')

        label = QtGui.QLabel("Type: ")
        row2_layout.addWidget(label)
        combobox = QtGui.QComboBox()
        combobox.addItem("Table Office", QtCore.QVariant("table_office"))
        combobox.addItem("Table Dorm", QtCore.QVariant("table_dorm"))
        combobox.addItem("Table House", QtCore.QVariant("table_house"))
        combobox.addItem("Shelf Office", QtCore.QVariant("shelf_office"))
        combobox.addItem("Shelf Dorm", QtCore.QVariant("shelf_dorm"))
        combobox.addItem("Shelf House", QtCore.QVariant("shelf_house"))
        self.connect(combobox, QtCore.SIGNAL('currentIndexChanged(int)'),
                     self.slot_update_surface_type)
        row2_layout.addWidget(combobox)
        self.surface_type_combobox = combobox

        self.add_line_edit('Camera: Height:', row2_layout, 'camera_height')
        self.add_line_edit('Camera: Angle:', row2_layout, 'camera_angle')

        #####################################
        #thrid row:
        row3_layout = QtGui.QHBoxLayout()
        left_layout.addLayout(row3_layout)

        #checkboxes:
        button = QtGui.QPushButton("&gen'n'save features")
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_generate_save_features)

        checkbox = QtGui.QCheckBox('&Training Set')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'),
                     self.slot_update_training_set)
        self.checkbox_training_set = checkbox

        checkbox = QtGui.QCheckBox('Te&st Set')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'),
                     self.slot_update_test_set)
        self.checkbox_test_set = checkbox

        checkbox = QtGui.QCheckBox('Labels, Groundp. checked')
        row3_layout.addWidget(checkbox)
        self.connect(checkbox, QtCore.SIGNAL('stateChanged(int)'),
                     self.slot_update_is_labeled)
        self.checkbox_is_labeled = checkbox

        button = QtGui.QPushButton("Train'n'save Classifiers (training set)")
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_train_and_save_Classifiers)

        button = QtGui.QPushButton('Test Classifiers (on current)')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_test_Classifiers)

        button = QtGui.QPushButton('Test Classifiers (on testset)')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_test_Classifiers_on_testset)

        button = QtGui.QPushButton('Load Classifiers')
        row3_layout.addWidget(button)
        self.connect(button, QtCore.SIGNAL('clicked()'),
                     self.slot_load_Classifiers)

        #        button = QtGui.QPushButton('Save Classifier')
        #        row3_layout.addWidget(button)
        #        self.connect(button, QtCore.SIGNAL('clicked()'), self.slot_save_Classifier )

        #####################################

        left_layout.addWidget(self.draw_widget)

        self.right_layout = QtGui.QVBoxLayout()
        self.right_layout.setAlignment(QtCore.Qt.AlignTop)

        self.outer_layout = QtGui.QHBoxLayout()
        self.outer_layout.addLayout(left_layout)
        self.outer_layout.addLayout(self.right_layout)

        self.polygon_comboboxes = []
        self.add_polygon_combobox()

        self.slot_update_polygons(self.current_dataset.polygons, 0)

        self.setLayout(self.outer_layout)

        self.resize(900, 700)
        self.load_values_from_dataset()

        self.init_in_progress = False

        #at startup, display newest:
        self.slot_last_dataset()
Пример #8
0
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
import roslib
roslib.load_manifest('laser_camera_segmentation')
from labeling import label_object, scan_dataset, scans_database

import copy

##WARNING! THIS DOES A PARTIAL COPY OF A DATABASE! BACKUP BEFOREHAND AND KNOW WHAT YOU'RE DOING!!##

path = '/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling'
f1 = 'database_changed.pkl'
db1 = scans_database.scans_database()
db1.load(path, f1)

f2 = 'database.pkl'
db2 = scans_database.scans_database()
db2.load(path, f2)

#assume db2 is equal or larger, copy changes from db1 to db2!
d2 = db2.get_first_dataset()
d1 = db1.get_first_dataset()
while False != d1:

    if False != d2 and d1.id == d2.id:
        print 'copy', d1.id
        d2.dict = copy.deepcopy(d1.dict)