text stringlengths 1 93.6k |
|---|
points = points[:FLAGS.limit] # limit to desired length
|
depth = np.linalg.norm(points, 2, axis=1)
|
# print(depth.shape, pred.shape, label.shape)
|
# evaluate for all distances
|
for idx in range(len(DISTANCES)):
|
# select by range
|
lrange = DISTANCES[idx][0]
|
hrange = DISTANCES[idx][1]
|
mask = np.logical_and(depth > lrange, depth <= hrange)
|
# mask by distance
|
# mask_depth = depth[mask]
|
# print("mask range, ", mask_depth.max(), mask_depth.min())
|
mask_label = label[mask]
|
mask_pred = pred[mask]
|
# add single scan to evaluation
|
evaluators[idx].addBatch(mask_pred, mask_label)
|
# print for all ranges
|
print("*" * 80)
|
for idx in range(len(DISTANCES)):
|
# when I am done, print the evaluation
|
m_accuracy = evaluators[idx].getacc()
|
m_jaccard, class_jaccard = evaluators[idx].getIoU()
|
# print for spreadsheet
|
sys.stdout.write('range {lrange}m to {hrange}m,'.format(lrange=DISTANCES[idx][0],
|
hrange=DISTANCES[idx][1]))
|
for i, jacc in enumerate(class_jaccard):
|
if i not in ignore:
|
sys.stdout.write('{jacc:.3f}'.format(jacc=jacc.item()))
|
sys.stdout.write(",")
|
sys.stdout.write('{jacc:.3f}'.format(jacc=m_jaccard.item()))
|
sys.stdout.write(",")
|
sys.stdout.write('{acc:.3f}'.format(acc=m_accuracy.item()))
|
sys.stdout.write('\n')
|
sys.stdout.flush()
|
# if FLAGS.codalab:
|
# results = {}
|
# for idx in range(len(DISTANCES)):
|
# # make string for distance
|
# d_str = str(DISTANCES[idx][-1])+"m_"
|
#
|
# # get values for this distance range
|
# m_accuracy = evaluators[idx].getacc()
|
# m_jaccard, class_jaccard = evaluators[idx].getIoU()
|
#
|
# # put in dictionary
|
# results[d_str+"accuracy_mean"] = float(m_accuracy)
|
# results[d_str+"iou_mean"] = float(m_jaccard)
|
# for i, jacc in enumerate(class_jaccard):
|
# if i not in ignore:
|
# results[d_str+"iou_"+class_strings[class_inv_remap[i]]] = float(jacc)
|
# # save to file
|
# with open('segmentation_scores_distance.txt', 'w') as yaml_file:
|
# yaml.dump(results, yaml_file, default_flow_style=False)
|
# <FILESEP>
|
import scapy.packet as packet
|
from scapy.all import Ether, raw
|
ENDIANNESS = 'little'
|
class MBIMStream:
|
def __init__(self, data):
|
self.data = data
|
def __len__(self):
|
return len(self.data)
|
def pop_raw(self, length):
|
ret, self.data = self.data[:length], self.data[length:]
|
return ret
|
def pop_str_len(self, length):
|
return str(self.pop_raw(length), "utf-8")
|
def pop_uint16(self):
|
return int.from_bytes(self.pop_raw(2), ENDIANNESS)
|
class MBIM:
|
def __init__(self, pkt):
|
if isinstance(pkt, packet.Packet):
|
assert len(pkt) >= 0x20
|
self.ndps = []
|
self.dgs = []
|
s = MBIMStream(raw(pkt))
|
self.usb_urb = s.pop_raw(0x20)
|
if len(s) < 0x1e: # no payload
|
return
|
assert s.pop_str_len(4) == "NCMH"
|
self.header_len = s.pop_uint16()
|
self.seq = s.pop_uint16()
|
assert s.pop_uint16() == len(pkt) - len(
|
self.usb_urb
|
) # if this fails, it probably means we had multiple datagram pointers in this packet
|
self.ndp_idx = s.pop_uint16()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.