Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do batchgenerator on many images in a folder? #103

Open
hiSyukri opened this issue Jul 17, 2022 · 0 comments
Open

How to do batchgenerator on many images in a folder? #103

hiSyukri opened this issue Jul 17, 2022 · 0 comments

Comments

@hiSyukri
Copy link

I would like to know on how can I do batchgenerator on many images in a folder?
Because right now in the code example_ipynb.ipynb is using the self._data; which mean the data from skimage. Because I have many datasets to be run.

`class DataLoader(DataLoaderBase):
def init(self, data, BATCH_SIZE=2, num_batches=None, seed=False):
super(DataLoader, self).init(data, BATCH_SIZE, num_batches, seed)
# data is now stored in self._data.

def generate_train_batch(self):
    # usually you would now select random instances of your data. We only have one therefore we skip this
    img = self._data
    
    # The camera image has only one channel. Our batch layout must be (b, c, x, y). Let's fix that
    img = np.tile(img[None, None], (self.BATCH_SIZE, 1, 1, 1))
    
    # now construct the dictionary and return it. np.float32 cast because most networks take float
    return {'data':img.astype(np.float32), 'some_other_key':'some other value'}`

this is the code.

Need your guide in this matter.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant