diff --git a/config/config_detect_only.yaml b/config/config_detect_only.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f5e469845206f48893beb69fb92be55ed1e30664 --- /dev/null +++ b/config/config_detect_only.yaml @@ -0,0 +1,23 @@ +# Configuration pour le laptop + +detector: + harvest : False + frame_before_exit : 30 + homography_path : './demo/homography_matrix.csv' + +cam : + dev_num : 2 + img_sz : [1280, 720] + pix_format : 'GREY' + brightness : 15 + +model : + path : './demo/model/model_demo.pt' + img_sz : [1280,1280] + show : True + verbose : False + +ip : + detectorIP : '192.168.125.42' + armIP : '192.168.125.1' + port : 50000 diff --git a/config/config_laptop.yaml b/config/config_laptop.yaml index 8eda96e1503ae1ead575739669fe98e2788c9c91..3401c430e70ebe48191aa892c5245e98d47bdb13 100644 --- a/config/config_laptop.yaml +++ b/config/config_laptop.yaml @@ -2,7 +2,7 @@ detector: harvest : True - frame_before_exit : 30 + frame_before_exit : 25 homography_path : './demo/homography_matrix.csv' cam : diff --git a/demo/detector.py b/demo/detector.py index e06d4150d5d36b355275c0954d0d7010e53cd567..c65e824b2ce9dd8ad9466f5f9dadfe5714003e61 100644 --- a/demo/detector.py +++ b/demo/detector.py @@ -27,25 +27,25 @@ class Detector : return config def __harvestCallback( self, predictor ) : - nothing = True - classes, coordinates = predictor.results[0].boxes.cls.cpu().numpy(), predictor.results[0].cpu().boxes.xywh.numpy() - for cl, coord in zip( classes, coordinates ) : - arm_coord = self.myArm.point_projection( (coord[0], coord[1]) ) - if not self.myArm.coordReachable( arm_coord ) or self.myModel.labelNum2Str( cl ) == 'hand' : pass - else : - nothing = False - if not self.harvest_job.is_alive() : + if not self.harvest_job.is_alive() : + nothing = True + classes, coordinates = predictor.results[0].boxes.cls.cpu().numpy(), predictor.results[0].cpu().boxes.xywh.numpy() + for cl, coord in zip( classes, coordinates ) : + arm_coord = self.myArm.point_projection( (coord[0], coord[1]) ) + if not self.myArm.coordReachable( arm_coord ) or self.myModel.labelNum2Str( cl ) == 'hand' : pass + else : + nothing = False print( "\n{} : x: {}, y: {}".format( self.myModel.labelNum2Str(cl), arm_coord[0], arm_coord[1] ) ) self.myArm.target = ( arm_coord[0], arm_coord[1], cl ) self.startHarvestJob() break - if nothing : self.nothing_counter += 1 - if self.isHarvestEnd() : - if not self.harvest_job.is_alive() : - print( "\n##### THE END #####\n") - self.myArm.target = ( 0, 0, self.myArm.end_value ) - self.startHarvestJob() - self.exit_status = True + if nothing : self.nothing_counter += 1 + if self.isHarvestEnd() : + if not self.harvest_job.is_alive() : + print( "\n##### THE END #####\n") + self.myArm.target = ( 0, 0, self.myArm.end_value ) + self.startHarvestJob() + self.exit_status = True def startHarvestJob( self ) : self.harvest_job = Thread( target = self.myArm.harvest, args = ( self.myArm.target, ) )