The error stopiteration is reported when using next (ITER (data. Dataloader()). This is because when using next() When accessing an iterator that has been iterated, an error will be triggered: stopiteration, that is, after a round of iteration after the dataloader imports the data, it is found that there is no data when importing again, that is, after the Iterable is completed, stopiteration is triggered, and then the loop jumps out
resolvent:
Since there is no data when importing again, we can use a data loader.
Put the in train.py
inps, targets = next(self.batch_iterator)
Change to:
try:
inps, targets = next(self.batch_iterator)
except StopIteration:
self.batch_iterator = iter(data.DataLoader(self.train_dataset, self.args.batch_size, shuffle=True, num_workers=self.args.num_workers, collate_fn=detection_collate))
inps, targets = next(self.batch_iterator)
Problem solving.
Read More:
- ValueError: num_samples should be a positive integer value, but got num_samp=0
- How to Fix Sklearn ValueError: This solver needs samples of at least 2 classes in the data, but the data
- RuntimeError: each element in
- Due to multi process — pychar debug breakpoint debugging encounter pychar dataloader will be stuck
- Tensorflow error record: depreciation warning: elementwise
- RuntimeError:An attempt has been made to start a new process before the……
- InternalError: Failed to create session. Error and solution
- A stopiteration exception is thrown after Python next() completes
- Solution of adding judgment error in the iterative process of Java iterator iterator
- The function of structured shuffleplit() in SK learn realizes the division of data set
- valueError: Length mismatch: Expected axis has 40 elements, new values have 38 elements
- RuntimeError: Couldn‘t open shared file mapping: <torch_16716_3565374679>, error code: <1455>
- Java – how to shuffle an ArrayList
- Keras:KeyError:‘Failed to format this callback filepath:{val_loss:.4f}.h5. Reason: \‘val_loss\‘‘
- raise ValueError(‘Expected input batch_size ({}) to match target batch_size ({}).‘
- [Solved] RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #2 ‘mat1‘
- Solve the problem of reporting errors when tsfresh downloads UCI har dataset
- How to Fix TypeError: Cannot cast array data from dtype(‘float64‘) to dtype(‘<U32‘)….
- Vector delete pop of element_ back(),erase(),remove()
- RuntimeError: Expected hidden[0] size (x, x, x), got(x, x, x)