Пример #1
0
point_orig_list = numpy.array(point_orig_list)
predicted_obj_id = numpy.array(predicted_obj_id)
gt_obj_id = numpy.array(gt_obj_id)
predicted_cls_id = numpy.array(predicted_cls_id)
gt_cls_id = numpy.array(gt_cls_id)

if save_viz:
    obj_color = numpy.random.randint(0, 255, (max(predicted_obj_id) + 1, 3))
    obj_color[0] = [100, 100, 100]
    point_orig_list[:, 3:6] = obj_color[predicted_obj_id, :]
    savePCD('viz/%s_area%d_predicted_obj_id.pcd' % (net_type, VAL_AREA),
            point_orig_list)
    point_orig_list[:, 3:6] = [class_to_color_rgb[c] for c in predicted_cls_id]
    savePCD('viz/%s_area%d_predicted_cls_id.pcd' % (net_type, VAL_AREA),
            point_orig_list)

print("Avg Comp Time: %.3f" % numpy.mean(comp_time))
print("CPU Mem: %.2f" % (psutil.Process(os.getpid()).memory_info()[0] / 1.0e9))
print("GPU Mem: %.1f" %
      (sess.run(tf.contrib.memory_stats.MaxBytesInUse()) / 1.0e6))
acc, iou, avg_acc, avg_iou, stats = get_cls_id_metrics(gt_cls_id,
                                                       predicted_cls_id)
nmi, ami, ars, _, _, _, hom, com, vms = get_obj_id_metrics(
    gt_obj_id, predicted_obj_id)
print(
    "NMI: %.3f AMI: %.3f ARS: %.3f HOM: %.3f COM: %.3f VMS: %.3f %d/%d clusters"
    % (nmi, ami, ars, hom, com, vms, len(
        numpy.unique(predicted_obj_id)), len(numpy.unique(gt_obj_id))))
print('all 0 0 0 %.3f 0 %.3f' % (acc, iou))
print('avg 0 0 0 %.3f 0 %.3f' % (avg_acc, avg_iou))
Пример #2
0
saver = tf.train.Saver()
saver.restore(sess, MODEL_PATH)
print('Restored network from %s'%MODEL_PATH)

rospy.init_node('inc_seg')
rospy.Subscriber('laser_cloud_surround',PointCloud2,cloud_surround_callback)
rospy.Subscriber('slam_out_pose',PoseStamped,pose_callback)
pubOutput = rospy.Publisher('output_cloud', PointCloud2, queue_size=1)
pubMarker = rospy.Publisher('markers', Marker, queue_size=10)
pubObjects = []
for c in classes:
	p = rospy.Publisher(c, PointCloud2, queue_size=1)
	pubObjects.append(p)
rospy.spin()

#ignore clutter in evaluation
valid_mask = numpy.array(gt_obj_id) > 0
gt_obj_id = numpy.array(gt_obj_id)[valid_mask]
predicted_obj_id = numpy.array(predicted_obj_id)[valid_mask]
gt_cls_id = numpy.array(gt_cls_id)[valid_mask]
predicted_cls_id = numpy.array(predicted_cls_id)[valid_mask]

print("Avg Comp Time: %.3f" % numpy.mean(comp_time))
print("CPU Mem: %.2f" % (psutil.Process(os.getpid()).memory_info()[0] / 1.0e9))
print("GPU Mem: %.1f" % (sess.run(tf.contrib.memory_stats.MaxBytesInUse()) / 1.0e6))
nmi, ami, ars, prc, rcl, iou, hom, com, vms = get_obj_id_metrics(gt_obj_id, predicted_obj_id)
print("NMI: %.3f AMI: %.3f ARS: %.3f PRC: %.3f RCL: %.3f IOU: %.3f HOM: %.3f COM: %.3f VMS: %.3f %d/%d clusters"% (nmi,ami,ars,prc, rcl, iou, hom,com,vms,len(numpy.unique(predicted_obj_id)),len(numpy.unique(gt_obj_id))))
acc, iou, avg_acc, avg_iou, stats = get_cls_id_metrics(gt_cls_id, predicted_cls_id, class_labels=classes, printout=False)
print('all 0 0 0 %.3f 0 %.3f' % (acc, iou))
print('avg 0 0 0 %.3f 0 %.3f' % (avg_acc, avg_iou))
Пример #3
0
        for offset in itertools.product([-1,0,1],[-1,0,1],[-1,0,1]):
            if offset!=(0,0,0):
                kk = (k[0]+offset[0], k[1]+offset[1], k[2]+offset[2])
                if kk in point_id_map and predicted_cls_id[point_id_map[kk]]==predicted_cls_id[i]:
                    edges.append([i, point_id_map[kk]])

    #calculate connected components from edges
    G = nx.Graph(edges)
    clusters = nx.connected_components(G)
    clusters = [list(c) for c in clusters]
    predicted_obj_id = numpy.zeros(len(point_voxels),dtype=int)
    min_cluster_size = 10
    cluster_id = 1
    for i in range(len(clusters)):
        if len(clusters[i]) > min_cluster_size:
            predicted_obj_id[clusters[i]] = cluster_id
            cluster_id += 1

    predicted_cls_id_arr.extend(predicted_cls_id)
    predicted_obj_id_arr.extend(predicted_obj_id)

print('Avg Comp Time: 0')
print('CPU Mem: 0')
print('GPU Mem: 0')
acc, iou, avg_acc, avg_iou, stats = get_cls_id_metrics(numpy.array(gt_cls_id_arr), numpy.array(predicted_cls_id_arr))
nmi, ami, ars, _, _, _, hom, com, vms = get_obj_id_metrics(numpy.array(gt_obj_id_arr), numpy.array(predicted_obj_id_arr))
print("NMI: %.3f AMI: %.3f ARS: %.3f HOM: %.3f COM: %.3f VMS: %.3f %d/%d clusters"% (nmi,ami,ars,hom,com,vms,len(numpy.unique(predicted_obj_id_arr)),len(numpy.unique(gt_obj_id_arr))))
print('all 0 0 0 %.3f 0 %.3f' % (acc, iou))
print('avg 0 0 0 %.3f 0 %.3f' % (avg_acc, avg_iou))