def publish_object_ids(self, ids, y):
     msg = ObjectIds()
     msg.ids = ids
     idx = np.argsort(y)
     msg.header = self.last_header
     msg.ids = np.array(ids)[idx]
     msg.offsets = [0]
     msg.labels = [y[idx[0]]]
     for i in range(1, len(y)):
         if (y[idx[i]] != y[idx[i - 1]]):
             msg.labels.append(y[idx[i]])
             msg.offsets.append(i)
     msg.offsets.append(len(y))
     self.pub_objs.publish(msg)