Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions torchvision/datasets/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ class EMNIST(MNIST):
md5 = "58c8d27c78d21e728a6bc7b3cc06412e"
splits = ('byclass', 'bymerge', 'balanced', 'letters', 'digits', 'mnist')
# Merged Classes assumes Same structure for both uppercase and lowercase version
_merged_classes = set(['C', 'I', 'J', 'K', 'L', 'M', 'O', 'P', 'S', 'U', 'V', 'W', 'X', 'Y', 'Z'])
_all_classes = set(list(string.digits + string.ascii_letters))
_merged_classes = {'c', 'i', 'j', 'k', 'l', 'm', 'o', 'p', 's', 'u', 'v', 'w', 'x', 'y', 'z'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One remark concerning cosmetics, not actual functionality. The EMNIST paper describes removing the capital letters. We can actually write the classes in a way that achieves this but then the labels will look weird; something like: A, B, c, D, .... So I think @vballoli's solution is fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this is fine as is, but thanks for pointing it out

_all_classes = set(string.digits + string.ascii_letters)
classes_split_dict = {
'byclass': list(_all_classes),
'byclass': sorted(list(_all_classes)),
'bymerge': sorted(list(_all_classes - _merged_classes)),
'balanced': sorted(list(_all_classes - _merged_classes)),
'letters': list(string.ascii_lowercase),
'letters': ['N/A'] + list(string.ascii_lowercase),
'digits': list(string.digits),
'mnist': list(string.digits),
}
Expand Down