Esempio n. 1
0
    def __createMap(self, xmlfile):
        """根据配置文件中map映射关系,建立各个资源的连接情况"""
        def nameScan(rs, name):
            for r in rs:
                if r.name == name:
                    return r
            return None

        def fullNameScan(rs, fullname):
            for name in fullname.split(":"):
                ret =  nameScan(rs, name)
                if ret == None:
                    break
                else:
                    rs = ret.children
            return ret

        node = Parse().getElementTreeRoot(xmlfile).find("resources_map")
        for con in node.findall("con"):
            r1,r2 = fullNameScan(self.children, con.get("con1")),fullNameScan(self.children, con.get("con2"))
            r1.connect.append(r2)
            r2.connect.append(r1)
Esempio n. 2
0
                        old_center_x, old_center_y = px + pw / 2.0, py + ph / 2.0

                        x_ping, y_ping, w_suo, h_suo = R_result[0][1], \
                                                       R_result[0][2], \
                                                       R_result[0][3], \
                                                       R_result[0][4]
                        new__center_x = x_ping * pw + old_center_x
                        new__center_y = y_ping * ph + old_center_y
                        new_w = pw * np.exp(w_suo.data.cpu().numpy())
                        new_h = ph * np.exp(h_suo.data.cpu().numpy())
                        a = new__center_x.data.cpu().numpy()
                        b = new__center_y.data.cpu().numpy()
                        a = float(a)
                        b = float(b)
                        new_verts = [a, b, new_w, new_h]
                        results.append(new_verts)
                        results_label.append(pred[0])
                        print('find proposal, label:', pred[0], "rect:",
                              new_verts)
            count += 1

    def NMS(self):
        pass


if __name__ == '__main__':
    parse = Parse()
    config = parse.config
    image = cv2.imread(config.test_example)
    rcnn = RCNN(config=config)
    rcnn.test(image)
Esempio n. 3
0
 def __registChildren(self, xmlfile):
     node = Parse().getElementTreeRoot(xmlfile).find("resources")
     self.addChild(map(self.libSearch, node.getchildren()))