# Weird debug messages in log when using resnet50?

**URL:** <https://discuss.pytorch.org/t/weird-debug-messages-in-log-when-using-resnet50/166921>\
**Category:** vision\
**Created:** [November 25, 2022, 8:48pm UTC](https://discuss.pytorch.org/t/weird-debug-messages-in-log-when-using-resnet50/166921 "2022-11-25T20:48:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukasKarner](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/lukaskarner/32/55176_2.png) [@LukasKarner](https://discuss.pytorch.org/u/LukasKarner)\
**Post date:** [November 25, 2022, 8:48pm UTC](https://discuss.pytorch.org/t/weird-debug-messages-in-log-when-using-resnet50/166921/1 "2022-11-25T20:48:42Z")

</div>

I just successfully ran Pytorch’s implementation of ResNet50 with pre-trained weights on ImageNet.  
However something dumped thousands of strange debug messages in my log file.  
They appear to come in groups as there are recurring patterns in the tags, here is an exemplary collection of them:

```auto
2022-11-25 21:44:12,649 DEBUG: tag: Orientation (274) - type: short (3) - value: b'\x00\x01'
2022-11-25 21:44:12,649 DEBUG: tag: XResolution (282) - type: rational (5) Tag Location: 34 - Data Location: 98 - value: b'\x00\x00\x00\x1c\x00\x00\x00\x01'
2022-11-25 21:44:12,649 DEBUG: tag: YResolution (283) - type: rational (5) Tag Location: 46 - Data Location: 106 - value: b'\x00\x00\x00\x1c\x00\x00\x00\x01'
2022-11-25 21:44:12,650 DEBUG: tag: ResolutionUnit (296) - type: short (3) - value: b'\x00\x03'
2022-11-25 21:44:12,650 DEBUG: tag: Software (305) - type: string (2) Tag Location: 70 - Data Location: 114 - value: b'Adobe Photoshop 7.0\x00'
2022-11-25 21:44:12,650 DEBUG: tag: DateTime (306) - type: string (2) Tag Location: 82 - Data Location: 134 - value: b'2004:01:20 13:12:15\x00'
2022-11-25 21:44:12,650 DEBUG: tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\x9c'
2022-11-25 21:44:15,997 DEBUG: tag: Software (305) - type: string (2) Tag Location: 22 - Data Location: 62 - value: b'EXIFutils V2.7.4'
2022-11-25 21:44:15,998 DEBUG: tag: Artist (315) - type: string (2) Tag Location: 34 - Data Location: 78 - value: b'Wendy Knipe'
2022-11-25 21:44:15,998 DEBUG: tag: Copyright (33432) - type: string (2) Tag Location: 46 - Data Location: 90 - value: <table: 59 bytes>
2022-11-25 21:44:15,998 DEBUG: tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\x96'

```

Can someone tell me where these come from and/or how I can suppress them?

best  
Lukas

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [November 25, 2022, 9:03pm UTC](https://discuss.pytorch.org/t/weird-debug-messages-in-log-when-using-resnet50/166921/2 "2022-11-25T21:03:32Z")

</div>

I think these debug logs are raised by `PIL` if it cannot detect the image file format.  
You might try to set the logging level a bit higher via:

```python
logging.getLogger("PIL.PngImagePlugin").setLevel(logging.CRITICAL + 1)

```

and see if it helps.  
Also, I’m unsure if the `PIL.PngImagePlugin` is raising these logs, so you might need to change it.

---

<div class="post-metadata">

**Author:** ![LukasKarner](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/lukaskarner/32/55176_2.png) [@LukasKarner](https://discuss.pytorch.org/u/LukasKarner)\
**Post date:** [November 25, 2022, 10:39pm UTC](https://discuss.pytorch.org/t/weird-debug-messages-in-log-when-using-resnet50/166921/3 "2022-11-25T22:39:37Z")

</div>

Almost correct! The suggested fix didn’t work, but I then changed the log format to display the path of the file where the message was logged, and it turns out `PIL.TiffImagePlugin` causes the trouble.  
So the solution is:

```auto
logging.getLogger("PIL.TiffImagePlugin").setLevel(51)

```

.
