I need a dataset object that contains only images for unsupervised learning in Chainer framework. I am trying to use DatasetMixin for this purpose.
Images is a list containing images.
class SimpleDataset(dataset.DatasetMixin):
def __init__(self, Images):
self.Images = Images
def __len__(self):
return len(self.Images)
def get_example(self, i):
return self.Images[i]
The SimpleDataset Class seems to not able to read the images since when running trainer.run() I am getting error:
call() missing 1 required positional argument: 'x'
Do I need to process the image list furthur before putting it through DatasetMixin Class?
Is there something wrong with using DatasetMixin to feed just images this way?
What can I do to feed just images(without any labels or other things) to my model?
class AutoEncoder(chainer.Chain):
def __init__(self, n_in, n_out):
super(AutoEncoder, self).__init__(
l1 = L.Linear(n_in, n_out),
l2 = L.Linear(n_out, n_in)
)
self.add_param('decoder_bias', n_in)
self.decoder_bias.data[...] = 0
def __call__(self, x):
h1 = F.dropout(self.l1(x))
h2 = F.linear(h1, F.transpose(self.l1.W), self.decoder_bias)
return F.sigmoid(h2)
def encode(self, x):
return F.dropout(self.l1(x))
def decode(self, x):
return self.l2(x)
model = L.Classifier(AutoEncoder(40000, 1000), lossfun=F.mean_squared_error)
model.compute_accuracy = False