blueoil icon indicating copy to clipboard operation
blueoil copied to clipboard

Inconvenient staticmethod in Dataset Class

Open minux302 opened this issue 4 years ago • 0 comments

In Base dataset class, classes, num_classes, extend_dir are defined as static method. So when we want to change those method, we must duplicate Dataset Class. Sometimes this is inconvenient.

For example, It is not possible to change the class for each instance as follows.

class SomethingDataset(Base):
    def __init__(self, mode):
        if mode == "debug":
            self.class = [
               "classA", "classB"
            ]
        else:
           self.class = [
               "classA", "classB", "classC", "classD", ...
            ]
   ...

Currently we must do as follows.

class SomethingDataset(Base):
   ...

class DebugSomethingDataset(Base):
   # Reproduction of SomethingDataset

minux302 avatar Jun 19 '20 13:06 minux302