TypeError: pic should be PIL Image or ndarray. Got <class 'dict'>

Chandrasekar_P: <h2>&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=536x382 at 0x7F4ECC189290&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=530x410 at 0x7F4ECC18D7D0&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=544x425 at 0x7F4ECC188ED0&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=371x341 at 0x7F4ECC189B50&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=459x420 at 0x7F4F4424A3D0&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=500x370 at 0x7F4F44246E50&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=375x320 at 0x7F4F44248750&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=460x344 at 0x7F4F44247AD0&gt;<br>
&lt;PIL.PngImagePlugin.PngImageFile image mode=L size=388x345 at 0x7F4F4424A490&gt;</h2>
<p>TypeError                                 Traceback (most recent call last)<br>
 in <br>
1 if <strong>name</strong> == “<strong>main</strong>”:<br>
----&gt; 2     main()</p>
<p> in main()<br>
53     for epoch in range(num_epochs):<br>
54         # train for one epoch, printing every 10 iterations<br>
—&gt; 55         train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq=10)<br>
56<br>
57         # update the learning rate</p>
<p>~/anaconda3/A_Projects/engine.py in train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq)<br>
24         lr_scheduler = utils.warmup_lr_scheduler(optimizer, warmup_iters, warmup_factor)<br>
25<br>
—&gt; 26     for images, targets in metric_logger.log_every(data_loader, print_freq, header):<br>
27         images = list(image.to(device) for image in images)<br>
28         targets = [{k: v.to(device) for k, v in t.items()} for t in targets]</p>
<p>~/anaconda3/A_Projects/utils.py in log_every(self, iterable, print_freq, header)<br>
207             ])<br>
208         MB = 1024.0 * 1024.0<br>
–&gt; 209         for obj in iterable:<br>
210             data_time.update(time.time() - end)<br>
211             yield obj</p>
<p>~/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py in <strong>next</strong>(self)<br>
343<br>
344     def <strong>next</strong>(self):<br>
–&gt; 345         data = self._next_data()<br>
346         self._num_yielded += 1<br>
347         if self._dataset_kind == _DatasetKind.Iterable and \</p>
<p>~/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _next_data(self)<br>
854             else:<br>
855                 del self._task_info[idx]<br>
–&gt; 856                 return self._process_data(data)<br>
857<br>
858     def _try_put_index(self):</p>
<p>~/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py in _process_data(self, data)<br>
879         self._try_put_index()<br>
880         if isinstance(data, ExceptionWrapper):<br>
–&gt; 881             data.reraise()<br>
882         return data<br>
883</p>
<p>~/anaconda3/lib/python3.7/site-packages/torch/_utils.py in reraise(self)<br>
392             # (<a href="https://bugs.python.org/issue2651" rel="nofollow noopener">https://bugs.python.org/issue2651</a>), so we work around it.<br>
393             msg = KeyErrorMessage(msg)<br>
–&gt; 394         raise self.exc_type(msg)</p>
<p>TypeError: Caught TypeError in DataLoader worker process 0.<br>
Original Traceback (most recent call last):<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py”, line 178, in _worker_loop<br>
data = fetcher.fetch(index)<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py”, line 44, in fetch<br>
data = [self.dataset[idx] for idx in possibly_batched_index]<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py”, line 44, in <br>
data = [self.dataset[idx] for idx in possibly_batched_index]<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataset.py”, line 257, in <strong>getitem</strong><br>
return self.dataset[self.indices[idx]]<br>
File “”, line 68, in <strong>getitem</strong><br>
target=self.transforms(target)<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py”, line 70, in <strong>call</strong><br>
img = t(img)<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py”, line 101, in <strong>call</strong><br>
return F.to_tensor(pic)<br>
File “/home/chandrasekar/anaconda3/lib/python3.7/site-packages/torchvision/transforms/functional.py”, line 55, in to_tensor<br>
raise TypeError(‘pic should be PIL Image or ndarray. Got {}’.format(type(pic)))<br>
TypeError: pic should be PIL Image or ndarray. Got &lt;class ‘dict’&gt;</p>