MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / __init__

Method __init__

bindsnet/datasets/davis.py:23–142  ·  view source on GitHub ↗

Class to read the DAVIS dataset :param root: Path to the DAVIS folder that contains JPEGImages, Annotations, etc. folders. :param task: Task to load the annotations, choose between semi-supervised or unsupervised. :param subset: Set to load th

(
        self,
        root,
        task="unsupervised",
        subset="train",
        sequences="all",
        resolution="480p",
        size=(600, 480),
        codalab=False,
        download=False,
        num_samples: int = -1,
    )

Source from the content-addressed store, hash-verified

21 VOID_LABEL = 255
22
23 def __init__(
24 self,
25 root,
26 task="unsupervised",
27 subset="train",
28 sequences="all",
29 resolution="480p",
30 size=(600, 480),
31 codalab=False,
32 download=False,
33 num_samples: int = -1,
34 ):
35 # language=rst
36 """
37 Class to read the DAVIS dataset
38 :param root: Path to the DAVIS folder that contains JPEGImages, Annotations,
39 etc. folders.
40 :param task: Task to load the annotations, choose between semi-supervised or
41 unsupervised.
42 :param subset: Set to load the annotations
43 :param sequences: Sequences to consider, 'all' to use all the sequences in a
44 set.
45 :param resolution: Specify the resolution to use the dataset, choose between
46 '480' and 'Full-Resolution'
47 :param download: Specify whether to download the dataset if it is not present
48 :param num_samples: Number of samples to pass to the batch
49 """
50 super().__init__()
51
52 if subset not in self.SUBSET_OPTIONS:
53 raise ValueError(f"Subset should be in {self.SUBSET_OPTIONS}")
54 if task not in self.TASKS:
55 raise ValueError(f"The only tasks that are supported are {self.TASKS}")
56 if resolution not in self.RESOLUTION_OPTIONS:
57 raise ValueError(
58 f"You may only use one of these resolutions: {self.RESOLUTION_OPTIONS}"
59 )
60
61 self.task = task
62 self.subset = subset
63 self.resolution = resolution
64 self.size = size
65 self.codalab = codalab
66
67 # Sets the boolean converted if the size of the images must be scaled down
68 self.converted = not self.size == (600, 480)
69
70 # Sets a tag for naming the folder containing the dataset
71 self.tag = ""
72 if self.task == "unsupervised":
73 self.tag += "Unsupervised-"
74 if self.subset == "train" or self.subset == "val":
75 self.tag += "trainval"
76 else:
77 self.tag += self.subset
78 self.tag += "-" + self.resolution
79
80 # Makes a unique path for a given instance of davis

Callers

nothing calls this directly

Calls 1

_check_directoriesMethod · 0.95

Tested by

no test coverage detected