microsoft / anomalydetector

SR-CNN
MIT License
257 stars 70 forks source link

_pickle.UnpicklingError: could not find MARK #12

Open swathiraon opened 4 years ago

swathiraon commented 4 years ago

File "evalue.py", line 121, in total_time, results, savedscore = get_score(data_source, files, args.thres, args.missing_option) File "evalue.py", line 74, in get_score tmp_data = read_pkl(f) File "C:\anomalydetector-master\anomalydetector-master\srcnn\utils.py", line 47, in read_pkl def read_pkl(path): with open(path, 'rb') as f: return pickle.load(f)#this is where it throws error

dan-r95 commented 4 years ago

Have you found a solution? I used the sample dataset from /samples/test/sample.csv, but have not figured it out yet

Fayeben commented 3 years ago

Have you found a solution?

tarnjotbains commented 2 years ago

Has a solution been found to this issue?

StCross commented 2 years ago

I dont know why the authors use pickle to read data, but my method works well by changing pickle to pandas. here are my codes in evalue.py, get_score func:

def get_score(data_source, files, thres, option):
    total_time = 0
    results = []
    savedscore = []
    for f in files:
        print('reading', f)
        data = pd.read_csv(f)
        in_timestamp, in_value, in_label = data['timestamp'].values, data['value'].values, data['label'].values
        length = len(in_timestamp)
        if model == 'sr_cnn' and len(in_value) < window:
            print("length is shorter than win_size", len(in_value), window)
            continue
        time_start = time.time()
        timestamp, label, pre, scores = models[model](in_timestamp, in_value, in_label, window, net, option, thres)
        time_end = time.time()
        total_time += time_end - time_start
        results.append([timestamp, label, pre, f])
        savedscore.append([label, scores, f, timestamp])
    return total_time, results, savedscore