whyen-wang commited on
Commit
3449378
·
verified ·
1 Parent(s): 6aedde1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -0
README.md CHANGED
@@ -47,6 +47,8 @@ configs:
47
  ## Quick Start
48
  ### Usage
49
  ```python
 
 
50
  >>> dataset = load_dataset('whyen-wang/mnist')
51
  >>> example = dataset['train'][0]
52
  >>> print(example)
@@ -56,6 +58,20 @@ configs:
56
 
57
  ### Visualization
58
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ```
60
 
61
 
 
47
  ## Quick Start
48
  ### Usage
49
  ```python
50
+ >>> from datasets.load import load_dataset
51
+
52
  >>> dataset = load_dataset('whyen-wang/mnist')
53
  >>> example = dataset['train'][0]
54
  >>> print(example)
 
58
 
59
  ### Visualization
60
  ```
61
+ >>> import cv2
62
+ >>> import numpy as np
63
+ >>> from PIL import Image
64
+
65
+ >>> def visualize(example):
66
+ image = np.array(example['image'])
67
+ image = cv2.resize(image, (280, 280))
68
+ cv2.putText(
69
+ image, str(example['label']), (0, 50), cv2.FONT_HERSHEY_SIMPLEX,
70
+ 2, (255), 1, cv2.LINE_AA, False
71
+ )
72
+ return image
73
+
74
+ >>> Image.fromarray(example)
75
  ```
76
 
77