Code Monkey home page Code Monkey logo

Comments (2)

wladradchenko avatar wladradchenko commented on September 23, 2024

And if you take the model from README, then the result looks like the recognition does not work. So, I'm not sure in clear Evaluation Result. I have inspected on PCAPs with label Facebook, Skype, Youtube, VPN.
PCAP for test: https://drive.google.com/file/d/1LJWRKypmAO-7gheGNFRR3LPYaOJ-nRtE/view?usp=share_link

import torch
import pathlib
from ml.utils import load_cnn_model
from preprocessing import read_pcap, transform_packet
import torch.nn.functional as F
from utils import ID_TO_APP, ID_TO_TRAFFIC


if torch.cuda.is_available():
    print("GPU")

# model path
application = 'model/application_classification.cnn.model'
traffic = 'model/traffic_classification.cnn.model'

model = load_cnn_model(traffic, gpu=True)

print("Processing")

rows = []
batch_index = 0
for i, packet in enumerate(read_pcap(pathlib.Path("data/test/4.pcap"))):
    arr = transform_packet(packet)
    if arr is not None:
        y_pred = F.log_softmax(model(torch.Tensor(arr.todense().tolist()).cuda()), dim=1)
        y_hat = torch.argmax(y_pred, dim=1)
        # app_label = ID_TO_APP.get(int(y_hat))
        traffic_label = ID_TO_TRAFFIC.get(int(y_hat))
        print(traffic_label, round(y_pred.tolist()[0][int(y_hat)], 4))

I have got result:

  • a mistake with traffic model for recognition as Not VPN.
  • not YouTube app;
  • not clear result for Facebook.
  • maybe is ok with Skype.

from deep-packet.

365ms avatar 365ms commented on September 23, 2024

Try to correct the processed_data ,open one of the .json file,check the app_label and traffic_label ,if value is null that means u should add the specific prefix-id according to your dataset in utlis.py

from deep-packet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.