ManishThota commited on
Commit
3620263
·
verified ·
1 Parent(s): 1e38ac4

Update src/utils.py

Browse files
Files changed (1) hide show
  1. src/utils.py +21 -3
src/utils.py CHANGED
@@ -32,24 +32,42 @@ def parse_string(string, tags):
32
 
33
  return results
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def parse_annotations(annotations_list):
36
  """
37
  Converts a list of annotations into a dictionary of key-value pairs.
38
-
39
  Args:
40
  annotations_list (list): A list of annotations in the format 'key: value'.
41
-
42
  Returns:
43
  dict: A dictionary with annotation keys and values.
44
  """
45
  annotations_dict = {}
46
  for annotation in annotations_list:
47
  key, value = annotation.split(': ')
48
- annotations_dict[key] = int(value)
 
 
 
49
  return annotations_dict
50
 
51
 
52
 
 
53
  def encode_video(video_path):
54
  """
55
  Encodes a video file into a list of frames.
 
32
 
33
  return results
34
 
35
+ # def parse_annotations(annotations_list):
36
+ # """
37
+ # Converts a list of annotations into a dictionary of key-value pairs.
38
+
39
+ # Args:
40
+ # annotations_list (list): A list of annotations in the format 'key: value'.
41
+
42
+ # Returns:
43
+ # dict: A dictionary with annotation keys and values.
44
+ # """
45
+ # annotations_dict = {}
46
+ # for annotation in annotations_list:
47
+ # key, value = annotation.split(': ')
48
+ # annotations_dict[key] = int(value)
49
+ # return annotations_dict
50
+
51
  def parse_annotations(annotations_list):
52
  """
53
  Converts a list of annotations into a dictionary of key-value pairs.
 
54
  Args:
55
  annotations_list (list): A list of annotations in the format 'key: value'.
 
56
  Returns:
57
  dict: A dictionary with annotation keys and values.
58
  """
59
  annotations_dict = {}
60
  for annotation in annotations_list:
61
  key, value = annotation.split(': ')
62
+ if value == 'None':
63
+ annotations_dict[key] = None
64
+ else:
65
+ annotations_dict[key] = int(value)
66
  return annotations_dict
67
 
68
 
69
 
70
+
71
  def encode_video(video_path):
72
  """
73
  Encodes a video file into a list of frames.