MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / fit_generator

Method fit_generator

tensorflow/python/keras/engine/training.py:1162–1296  ·  view source on GitHub ↗

Fits the model on data yielded batch-by-batch by a Python generator. The generator is run in parallel to the model, for efficiency. For instance, this allows you to do real-time data augmentation on images on CPU in parallel to training your model on GPU. The use of `keras.utils.Se

(self,
                    generator,
                    steps_per_epoch=None,
                    epochs=1,
                    verbose=1,
                    callbacks=None,
                    validation_data=None,
                    validation_steps=None,
                    validation_freq=1,
                    class_weight=None,
                    max_queue_size=10,
                    workers=1,
                    use_multiprocessing=False,
                    shuffle=True,
                    initial_epoch=0)

Source from the content-addressed store, hash-verified

1160 return outputs
1161
1162 def fit_generator(self,
1163 generator,
1164 steps_per_epoch=None,
1165 epochs=1,
1166 verbose=1,
1167 callbacks=None,
1168 validation_data=None,
1169 validation_steps=None,
1170 validation_freq=1,
1171 class_weight=None,
1172 max_queue_size=10,
1173 workers=1,
1174 use_multiprocessing=False,
1175 shuffle=True,
1176 initial_epoch=0):
1177 """Fits the model on data yielded batch-by-batch by a Python generator.
1178
1179 The generator is run in parallel to the model, for efficiency.
1180 For instance, this allows you to do real-time data augmentation
1181 on images on CPU in parallel to training your model on GPU.
1182
1183 The use of `keras.utils.Sequence` guarantees the ordering
1184 and guarantees the single use of every input per epoch when
1185 using `use_multiprocessing=True`.
1186
1187 Arguments:
1188 generator: A generator or an instance of `Sequence`
1189 (`keras.utils.Sequence`)
1190 object in order to avoid duplicate data
1191 when using multiprocessing.
1192 The output of the generator must be either
1193 - a tuple `(inputs, targets)`
1194 - a tuple `(inputs, targets, sample_weights)`.
1195 This tuple (a single output of the generator) makes a single batch.
1196 Therefore, all arrays in this tuple must have the same length (equal
1197 to the size of this batch). Different batches may have different
1198 sizes.
1199 For example, the last batch of the epoch is commonly smaller than
1200 the
1201 others, if the size of the dataset is not divisible by the batch
1202 size.
1203 The generator is expected to loop over its data
1204 indefinitely. An epoch finishes when `steps_per_epoch`
1205 batches have been seen by the model.
1206 steps_per_epoch: Total number of steps (batches of samples)
1207 to yield from `generator` before declaring one epoch
1208 finished and starting the next epoch. It should typically
1209 be equal to the number of samples of your dataset
1210 divided by the batch size.
1211 Optional for `Sequence`: if unspecified, will use
1212 the `len(generator)` as a number of steps.
1213 epochs: Integer, total number of iterations on the data.
1214 verbose: Verbosity mode, 0, 1, or 2.
1215 callbacks: List of callbacks to be called during training.
1216 validation_data: This can be either
1217 - a generator for the validation data
1218 - a tuple (inputs, targets)
1219 - a tuple (inputs, targets, sample_weights).

Calls 3

_check_call_argsMethod · 0.95
setMethod · 0.45
get_cellMethod · 0.45