File size: 8,831 Bytes
52c18ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
---
annotations_creators:
- machine-generated
language: []
language_creators:
- machine-generated
license:
- mit
multilinguality: []
pretty_name: Blackjack
size_categories:
- 10K<n<100K
source_datasets:
- original
tags:
- attribute
- concepts
task_categories:
- image-classification
- image-segmentation
task_ids:
- multi-label-image-classification
- instance-segmentation
---

# Dataset Card for Blackjack

## Table of Contents
- [Table of Contents](#table-of-contents)
- [Dataset Description](#dataset-description)
  - [Dataset Summary](#dataset-summary)
- [Dataset Structure](#dataset-structure)
  - [Data Instances](#data-instances)
  - [Data Fields](#data-fields)
  - [Data Splits](#data-splits)
- [Dataset Creation](#dataset-creation)
  - [Curation Rationale](#curation-rationale)
  - [Annotations](#annotations)
  - [Personal and Sensitive Information](#personal-and-sensitive-information)
- [Additional Information](#additional-information)
  - [Licensing Information](#licensing-information)
  - [Citation Information](#citation-information)

## Dataset Description

### Dataset Summary

A dataset containing two sets of playing card images for hands in the card game Blackjack. Each set contains at least 10,000 images and has a series of attributes. This dataset is based on the dataset [Playing cards](https://huggingface.co/datasets/JackFurby/playing-cards) [1]

Train and test splits are provided in both JSON and pickle formats. Concept and task classification labels (both zero indexed) and names are provided in txt files.

## Dataset Structure

### Data Instances

Each set of samples have the following:
* player and dealer playing cards in each sample image
* A list of concepts present in the each sample (1 for concepts present and 0 otherwise)
* The task classification label
* coordinates for each of the corners of playing cards in each sample.

The basic structure of the JSON and pkl files describing each sample is as follows:

```
sample ID, {
	'img_path': string file path,
	'class_label': integer,
    'concept_label': list of 0s and 1s,
	'player_card_points': list of tuples and card class labels as integers
    'dealer_card_points': list of tuples and card class labels as integers
    'game_numer': integer
}
```

#### Standard

Card hands using a single style of playing cards.

* **Concepts**: soft/hard hand, sum of player cards, first dealer card, dealer has multiple cards
* **Class label**: Best move
* **Card points**: Coordinates of the card and card classification

##### Example

```
"14304": {
  "img_path": "imgs/standard/val/0/14304.png",
  "class_label": 0,
  "concept_label": [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
  "player_card_points": [[[[50, 789], [173, 789], [50, 974], [173, 974]], "QS"], [[[185, 789], [308, 789], [185, 974], [308, 974]], "5S"]],
  "dealer_card_points": [[[[172, 235], [50, 235], [172, 50], [50, 50]], "7D"]],
  "game_number": 0
}
```

#### Mixed

Card hands using a one style of playing cards for all Ace and Seven playing cards and a second style for all other cards.

* **Concepts**: soft/hard hand, sum of player cards, first dealer card, dealer has multiple cards
* **Class label**: Best move
* **Card points**: Coordinates of the card and card classification

##### Example

```
"0": {
  "img_path": "imgs/mixed_ace_seven/train/0/0.png",
  "class_label": 0,
  "concept_label": [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
  "player_card_points": [[[[173, 974], [50, 974], [173, 789], [50, 789]], "10S"], [[[185, 789], [308, 789], [185, 974], [308, 974]], "4H"]],
  "dealer_card_points": [[[[172, 235], [50, 235], [172, 50], [50, 50]], "QC"]],
  "game_number": 0
}

```

### Data Fields

* String file path from the root of the dataset to a given samples image file
* A list of concepts present in the each sample (1 for concepts present and 0 otherwise). The index of each value in this list corresponds to the label in concepts.txt.
* The task classification label. This corresponds the the label in classes.txt
* list of playing cards present in a given sample player hand. Each item in the list has a list of card coordinates (card coordinates are always in the order top left, top right, bottom left, bottom right) and the card classification label.
* list of playing cards present in a given sample player hand. Each item in the list has a list of card coordinates (card coordinates are always in the order top left, top right, bottom left, bottom right) and the card classification label.
* A number representing the game the sample belongs to. Samples are in order with full games of backjack represented.

### Data Splits

#### Standard

##### Task classifications

| Class name | Count train | Count val |
| --- | --- | --- |
| hit | 3576 | 1554 |
| stand | 3576 | 1554 |
| surrender | 3576 | 1554 |
| bust | 3576 | 1554 |

##### Concepts

| Concept name | Count train | Count val |
| --- | --- | --- |
| soft | 869 | 325 |
| hard | 13435 | 5891 |
| player_value_21_plus | 3576 | 1554 |
| player_value_21 | 620 | 278 |
| player_value_20 | 714 | 326 |
| player_value_19 | 517 | 220 |
| player_value_18 | 554 | 235 |
| player_value_17 | 621 | 270 |
| player_value_16 | 3994 | 1720 |
| player_value_15 | 724 | 271 |
| player_value_14 | 624 | 245 |
| player_value_13 | 599 | 269 |
| player_value_12 | 591 | 270 |
| player_value_11 | 306 | 165 |
| player_value_10 | 215 | 108 |
| player_value_9 | 192 | 85 |
| player_value_8 | 457 | 200 |
| dealer_card_2 | 735 | 373 |
| dealer_card_3 | 750 | 347 |
| dealer_card_4 | 810 | 317 |
| dealer_card_5 | 791 | 339 |
| dealer_card_6 | 821 | 351 |
| dealer_card_7 | 989 | 343 |
| dealer_card_8 | 901 | 321 |
| dealer_card_9 | 859 | 411 |
| dealer_card_10 | 6119 | 2773 |
| dealer_card_a | 1529 | 641 |
| dealer_multi_cards | 1788 | 778 |

#### Mixed

##### Task classification

| Class name | Count train | Count val |
| --- | --- | --- |
| hit | 3558 | 1550 |
| stand | 3558 | 1550 |
| surrender | 3558 | 1550 |
| bust | 3558 | 1550 |

##### Concepts

| Concept name | Count train | Count val |
| --- | --- | --- |
| soft | 849 | 343 |
| hard | 13383 | 5857 |
| player_value_21_plus | 3558 | 1550 |
| player_value_21 | 621 | 260 |
| player_value_20 | 705 | 308 |
| player_value_19 | 568 | 255 |
| player_value_18 | 542 | 236 |
| player_value_17 | 555 | 240 |
| player_value_16 | 3982 | 1741 |
| player_value_15 | 709 | 286 |
| player_value_14 | 655 | 276 |
| player_value_13 | 617 | 259 |
| player_value_12 | 556 | 277 |
| player_value_11 | 292 | 112 |
| player_value_10 | 219 | 107 |
| player_value_9 | 206 | 92 |
| player_value_8 | 447 | 201 |
| dealer_card_2 | 832 | 349 |
| dealer_card_3 | 787 | 327 |
| dealer_card_4 | 813 | 372 |
| dealer_card_5 | 720 | 358 |
| dealer_card_6 | 774 | 324 |
| dealer_card_7 | 841 | 367 |
| dealer_card_8 | 804 | 388 |
| dealer_card_9 | 875 | 375 |
| dealer_card_10 | 6370 | 2711 |
| dealer_card_a | 1416 | 629 |
| dealer_multi_cards | 1783 | 776 |

## Dataset Creation

### Curation Rationale

This dataset was created to test Concept Bottleneck Models [2] in a human-machine setting.

### Source Data

#### Initial Data Collection and Normalization

The dataset uses background from [3] and playing card images from [4]. The dataset is balanced to the task classification labels. The code used to generate the dataset is available here [5].

### Annotations

#### Annotation process

The annotation process was completed during the generation of the dataset.

#### Who are the annotators?

Annotations were completed by a machine.

### Personal and Sensitive Information

This dataset does not contain personal and sensitive Information.

## Additional Information

### Licensing Information

This dataset is licenced with the [MIT licence](https://choosealicense.com/licenses/mit/).

### Citation Information

[1] Furby, J., Cunnington, D., Braines, D., Preece, A.: Can we constrain concept bottleneck models to learn semantically meaningful input features? (2024), https://arxiv.org/abs/2402.00912

[2] Koh, P.W., Nguyen, T., Tang, Y.S., Mussmann, S., Pierson, E., Kim, B. &amp; Liang, P.. (2020). Concept Bottleneck Models. Proceedings of the 37th International Conference on Machine Learning, in Proceedings of Machine Learning Research 119:5338-5348 Available from https://proceedings.mlr.press/v119/koh20a.html.

[3] M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed and A. Vedaldi, "Describing Textures in the Wild," 2014 IEEE Conference on Computer Vision and Pattern Recognition, 2014, pp. 3606-3613, doi: 10.1109/CVPR.2014.461.

[4] j4p4n, "Full Deck Of Ornate Playing Cards - English", Available at: https://openclipart.org/download/315253/1550166858.svg

[5] J. Furby, "blackjack-dataset-generator", Available at: https://github.com/JackFurby/blackjack-dataset-generator