File size: 548 Bytes
320e465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from os import path
import copy
import json


class BURSTResultHandler:
    def __init__(self, dataset_json):
        self.dataset_json = copy.deepcopy(dataset_json)

        # get rid of the segmentations while keeping the metadata
        self.dataset_json['sequences'] = []

    def add_sequence(self, sequence_json):
        self.dataset_json['sequences'].append(sequence_json)

    def dump(self, root):
        json_path = path.join(root, 'predictions.json')
        with open(json_path, 'w') as f:
            json.dump(self.dataset_json, f)