Skip to content

Commit d63a336

Browse files
Yosua Michael Maranathafacebook-github-bot
authored andcommitted
[fbsync] fix prototype dataset imagenet mock data (#7009)
Summary: * fix prototype dataset imagenet mock data * [REVERT ME] temporarily add prototype datasets test to CI * Revert "[REVERT ME] temporarily add prototype datasets test to CI" This reverts commit 7cafb5f. Reviewed By: datumbox Differential Revision: D41836895 fbshipit-source-id: bc6ae8b90f0220ea321f33d3231bb0a150c23e30
1 parent f177e89 commit d63a336

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

test/builtin_dataset_mocks.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import random
1313
import shutil
1414
import unittest.mock
15-
import warnings
1615
import xml.etree.ElementTree as ET
1716
from collections import Counter, defaultdict
1817

@@ -519,10 +518,22 @@ def imagenet(root, config):
519518
]
520519
num_children = 1
521520
synsets.extend((0, "", "", "", num_children, [], 0, 0) for _ in range(5))
522-
with warnings.catch_warnings():
523-
# The warning is not for savemat, but rather for some internals savemet is using
524-
warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning)
525-
savemat(data_root / "meta.mat", dict(synsets=synsets))
521+
synsets = np.array(
522+
synsets,
523+
dtype=np.dtype(
524+
[
525+
("ILSVRC2012_ID", "O"),
526+
("WNID", "O"),
527+
("words", "O"),
528+
("gloss", "O"),
529+
("num_children", "O"),
530+
("children", "O"),
531+
("wordnet_height", "O"),
532+
("num_train_images", "O"),
533+
]
534+
),
535+
)
536+
savemat(data_root / "meta.mat", dict(synsets=synsets))
526537

527538
make_tar(root, devkit_root.with_suffix(".tar.gz").name, compression="gz")
528539
else: # config["split"] == "test"

0 commit comments

Comments
 (0)