DeepTrackAI / DeepTrack2

DeepTrack2
MIT License
157 stars 47 forks source link

Training a model from multiple images #186

Closed gournge closed 1 year ago

gournge commented 1 year ago

Hi! I am trying to train LodeSTAR on multiple images - they are all small snapshots of particles of slightly different shapes and sizes. Unfortunately I only noticed in the provided examples that the model was trained on a dataset generated from one image only.

Perhaps there is way to somehow utilize the SequentialGenerator?

Thanks in advance :)

BenjaminMidtvedt commented 1 year ago

Hi! No problem, to train on multiple examples, simply do:

import random
my_crops = [crop_1, crop_2, ...]

random_crop = dt.Value(lambda: random.choice(my_crops))

model = dt.models.LodeSTAR()
model.fit(random_crop, batch_size=8, epochs=50, steps_per_epoch=100)