iscxvpn2016_loader = iscxvpn2016(pcap_dir="D://Datasets/ISCXVPN2016/", h5_dir="D://Datasets/packets-50k/", max_packets_on_cache=50000, as_bit=False, verbose=True) ustctfc2016_loader = ustctfc2016(pcap_dir="D://Datasets/USTC-TFC2016/", h5_dir="D://Datasets/USTC-TFC2016-packets-50k/", max_packets_on_cache=50000, as_bit=False, verbose=True) classifiers = { # "relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), # "reg_relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), # "protonet_1": M.ProtonetClassifier(in_channels=52, mid_channels=[], out_channels=32), # "protonet_2": M.ProtonetClassifier(in_channels=52, mid_channels=[64], out_channels=32), # "protonet_3": M.ProtonetClassifier(in_channels=52, mid_channels=[128, 64], out_channels=32), # "protonet_4": M.ProtonetClassifier(in_channels=52, mid_channels=[256, 128, 64], out_channels=32), # "protonet_bottleneck_end": M.ProtonetClassifier(in_channels=52, mid_channels=[256, 128, 64], out_channels=10), # "protonet_bottleneck_mid": M.ProtonetClassifier(in_channels=52, mid_channels=[128, 32, 128], out_channels=32), "protonet_mini_byte_1": M.ProtonetClassifier(in_channels=52, mid_channels=[66], out_channels=10), "protonet_mini_byte_2": M.ProtonetClassifier(in_channels=52, mid_channels=[26], out_channels=10), # "simnet_simple": M.SimnetClassifier(in_channels=52, channels=[10]), # "simnet_1": M.SimnetClassifier(in_channels=52, channels=[32]), # "simnet_2": M.SimnetClassifier(in_channels=52, channels=[64, 32]), # "simnet_3": M.SimnetClassifier(in_channels=52, channels=[128, 64, 32]), # "reg_protonet_1": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=32), # "reg_protonet_2": M.ProtonetClassifier(in_channels=416, mid_channels=[64], out_channels=32), # "reg_protonet_3": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 64], out_channels=32), # "reg_protonet_4": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=32), # "reg_protonet_bottleneck_end": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=10), # "reg_protonet_bottleneck_mid": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 32, 128], out_channels=32), # "reg_simnet_simple": M.SimnetClassifier(in_channels=416, channels=[10]),
shuffle=True, generator=generator) load = dataloader.iscxvpn2016(pcap_dir="D://Datasets/ISCXVPN2016/", h5_dir="D://Datasets/packets-15k/", as_bit=True) datasets = { "a": load("youtube"), "b": load("youtube"), "c": load("youtube"), "d": load("youtube") } confmat = plmc.ConfusionMatrix(num_classes=4) network = model.ProtonetClassifier(416, 10) dl = build_dataloader(datasets, n_support=50, n_queries=10) step = 0 for queries, labels, *supports in dl: # print(a.size()) # print(b.size()) # print(len(supports)) # for i, s in enumerate(supports): # print(f"support {i}", s.size()) logits = network(queries, *supports) print(confmat(logits, labels)) step += 1
h5_dir="D://Datasets/USTC-TFC2016-packets-50k/", max_packets_on_cache=50000, as_bit=True, verbose=True) classifiers = { # "relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), # "reg_relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), # "relation_2": M.RelationNetClassifier(in_channels=416, feature_channels=[32, 10], simnet_channels=[32, 16, 4]), # "reg_relation_2": M.RelationNetClassifier(in_channels=416, feature_channels=[32, 10], simnet_channels=[32, 16, 4]), # "relation_3": M.RelationNetClassifier(in_channels=416, feature_channels=[64, 32], simnet_channels=[64, 32, 16, 4]), # "reg_relation_3": M.RelationNetClassifier(in_channels=416, feature_channels=[64, 32], simnet_channels=[64, 32, 16, 4]), # "relpnet_1": M.RelationNetClassifier_Protonet1(simnet_channels=[128, 64, 32]), "protonet_mini_bit": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=10), # "protonet_1": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=32), # "protonet_2": M.ProtonetClassifier(in_channels=416, mid_channels=[64], out_channels=32), # "protonet_3": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 64], out_channels=32), # "protonet_4": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=32), # "protonet_bottleneck_end": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=10), # "protonet_bottleneck_mid": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 32, 128], out_channels=32), # "simnet_simple": M.SimnetClassifier(in_channels=416, channels=[10]), # "simnet_1": M.SimnetClassifier(in_channels=416, channels=[32]), # "simnet_2": M.SimnetClassifier(in_channels=416, channels=[64, 32]), # "simnet_3": M.SimnetClassifier(in_channels=416, channels=[128, 64, 32]), # "reg_protonet_1": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=32), # "reg_protonet_2": M.ProtonetClassifier(in_channels=416, mid_channels=[64], out_channels=32),
import torchvision.transforms.functional as T iscxvpn2016_loader = iscxvpn2016(pcap_dir="D://Datasets/ISCXVPN2016/", h5_dir="D://Datasets/packets-50k/", max_packets_on_cache=50000, as_bit=True, verbose=True) ustctfc2016_loader = ustctfc2016(pcap_dir="D://Datasets/USTC-TFC2016/", h5_dir="D://Datasets/USTC-TFC2016-packets-50k/", max_packets_on_cache=50000, as_bit=True, verbose=True) classifiers = { # "relpnet_1": M.RelationNetClassifier_Protonet1(simnet_channels=[128, 64, 32]), # "protonet_mini_bit": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=10), # "relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), # "reg_relation_1": M.RelationNetClassifier(in_channels=416, feature_channels=[10], simnet_channels=[32, 16, 4]), "protonet_1": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=32), "protonet_2": M.ProtonetClassifier(in_channels=416, mid_channels=[64], out_channels=32), "protonet_3": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 64], out_channels=32), "protonet_4": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=32), # "protonet_bottleneck_end": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=10), # "protonet_bottleneck_mid": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 32, 128], out_channels=32), # "simnet_simple": M.SimnetClassifier(in_channels=416, channels=[10]), # "simnet_1": M.SimnetClassifier(in_channels=416, channels=[32]), # "simnet_2": M.SimnetClassifier(in_channels=416, channels=[64, 32]), # "simnet_3": M.SimnetClassifier(in_channels=416, channels=[128, 64, 32]), # "reg_protonet_1": M.ProtonetClassifier(in_channels=416, mid_channels=[], out_channels=32), # "reg_protonet_2": M.ProtonetClassifier(in_channels=416, mid_channels=[64], out_channels=32), # "reg_protonet_3": M.ProtonetClassifier(in_channels=416, mid_channels=[128, 64], out_channels=32), # "reg_protonet_4": M.ProtonetClassifier(in_channels=416, mid_channels=[256, 128, 64], out_channels=32),