def initialize_subscr_topics(self):

        # Initialize all the subscriber topics
        # self.h5_dvc_subscr_obj = ecal.subscriber(json_data['device_request'])
        self.h5_chnl_subscr_obj = ecal.subscriber(json_data['channel_request'])
        self.h5_img_subscr_obj = ecal.subscriber(json_data['hfl_request'])
        self.h5_pixelwriter_obj = ecal.subscriber(
            json_data['pixelwrite_request'])
Esempio n. 2
0
    def initialize_subscr_topics(self):

        # Initialize all the subscriber topics
        self.pnt_cld_dvc_subscr_obj = ecal.subscriber(
            json_data['pointcloud_device_request'])
        self.pnt_cld_data_subscr_obj = ecal.subscriber(
            json_data['pointcloud_data_request'])
        self.pnt_cld_end_subscr_obj = ecal.subscriber(
            json_data['pointcloud_end_response'])
    def __init__(self):

        # Subscribe to the eCAL message to get the bsig path and the
        # signal names

        # self.bsig_path = bsig_pth
        #
        ecal.initialize(sys.argv, "Python signal value publisher")
        # Subscribe to RadarSignalRequest topic
        self.bsig_subscr_obj = ecal.subscriber(topic_name="BsigSignalNames")
        self.bsig_pub_obj = ecal.publisher(topic_name="BsigSignalValues")
        self.bsig_tmstamp_lst = []
        self.sig_name_lst = []
        self.subscribe_ecal_msgs()
Esempio n. 4
0
def subscribe_signl_names():

    ecal.initialize(sys.argv, "Detector mask subscriber")
    subscribe_sig_names_obj = ecal.subscriber(topic_name="Pixel_Response")
    rdr_sig_response = AlgoInterface_pb2.LabelResponse()

    while ecal.ok():
        ret, msg, time = subscribe_sig_names_obj.receive(500)
        print("---:: ", ret, msg, time, type(msg))
        if msg is not None:
            rdr_sig_response.ParseFromString(msg)
            object_attibute_lst = rdr_sig_response.NextAttr
            # print("object_attibute :: ", object_attibute_lst)

            for evry_obj_attr in object_attibute_lst:
                track_id = evry_obj_attr.trackID
                # print("track_id ::> ", track_id)
                class_obj = evry_obj_attr.type.object_class
                # print("class_obj :: ", class_obj)
                x1 = evry_obj_attr.ROI[0].X
                y1 = evry_obj_attr.ROI[0].Y

                x2 = evry_obj_attr.ROI[1].X
                y2 = evry_obj_attr.ROI[1].Y

                x3 = evry_obj_attr.ROI[2].X
                y3 = evry_obj_attr.ROI[2].Y

                x4 = evry_obj_attr.ROI[3].X
                y4 = evry_obj_attr.ROI[3].Y

                print("ordinates :: ", x1, x2, x3, x4, y1, y2, y3, y4)

                mask = evry_obj_attr.mask
                with open('img.txt', 'w+') as fhandle:
                    fhandle.write(str(mask))

                nparr = np.fromstring(mask, np.uint8)

                print("nparr :: ", nparr)
                re_img_np_ary = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
                img_shape = re_img_np_ary.shape
                print("shape::", img_shape)
                cv2.imwrite('color_img.jpg', re_img_np_ary)
                cv2.imshow('Color image', re_img_np_ary)
                cv2.waitKey(0)
                cv2.destroyAllWindows()
Esempio n. 5
0
import json
import cv2

if getattr(sys, 'frozen', False):
    os.chdir(sys._MEIPASS)

with open('topics.json') as data_file:
    json_data = json.load(data_file)
    # print(json_data)

request = str(json_data['request'])
response = str(json_data['response'])
h5_filename = str(json_data['h5_filename'])

ecal.initialize(sys.argv, "HFL data publisher")
hfl_subscr_obj = ecal.subscriber(request)
hfl_publs_obj = ecal.publisher(topic_name=response)

hfl_req_proto_obj = imageservice_pb2.ImageRequest()
hfl_resp_proto_obj = imageservice_pb2.HFLResponse()


class H5ReaderSequence(object):
    def __init__(self, fname):
        self.reset(fname)
        self.lastLoadFilename = ""

    def reset(self, fname):
        if not os.path.isfile(fname):
            print("Error - H5 file not available: %s!" % fname)
            sys.exit()
 def initialize_subscr_topics(self):
     # Initialize all the subscriber topics
     # self.lt5_img_subscr_obj = ecal.subscriber(self.json_data['image_request'])
     self.lt5_img_subscr_obj = ecal.subscriber(self.tracker_request)
     self.lt5_finl_subscr_obj = ecal.subscriber(self.json_data['algo_end_response'])
FROZEN_MODEL = "mask_rcnn_coco.h5"
TOPICS_JSON = 'topics.json'

with open(TOPICS_JSON) as data_file:
    json_data = json.load(data_file)
    # print(json_data)

request = str(json_data['image_request'])
response = str(json_data['image_response'])
vis_flag = True if str(json_data['visualization']) == "True" else False
full_eff_flag = True if str(json_data['full_efficiency']) == "True" else False

ecal.initialize(sys.argv, "Mask RCNN MS COCO detector")
ld_req_obj = imageservice_pb2.ImageResponse()
subscriber_obj = ecal.subscriber(topic_name=request)

lbl_response_obj = AlgoInterface_pb2.LabelResponse()
publisher_roi_obj = ecal.publisher(topic_name=response)


class InferenceConfig(coco.CocoConfig):
    # Set batch size to 1 since we'll be running inference on
    # one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPU
    GPU_COUNT = 1
    IMAGES_PER_GPU = 1
    if not full_eff_flag:
        IMAGE_MIN_DIM = 512
        IMAGE_MAX_DIM = 512