Jingyi77 commited on
Commit
18feb52
·
verified ·
1 Parent(s): 2bdb7af

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +35 -126
README.md CHANGED
@@ -1,145 +1,54 @@
1
- ---
2
- language:
3
- - zh
4
- license:
5
- - mit
6
- multilinguality:
7
- - monolingual
8
- size_categories:
9
- - 1K<n<10K
10
- source_datasets:
11
- - original
12
- task_categories:
13
- - text-classification
14
- - image-classification
15
- task_ids:
16
- - sentiment-classification
17
- tags:
18
- - advertisement
19
- - social-media
20
- - xiaohongshu
21
- - RedNote
22
- pretty_name: CHASM - Covert Advertisement on RedNote
23
- configs:
24
- - config_name: default
25
- default: true
26
- data_files:
27
- - split: train
28
- path: "train.parquet"
29
- - split: validation
30
- path: "validation.parquet"
31
- - split: test
32
- path: "test.parquet"
33
- ---
34
 
35
- <!-- @format -->
36
 
37
- # CHASM Dataset
38
 
39
- CHASM (Covert Advertisement on RedNote) is a dataset containing RedNote posts for text and image classification tasks focused on identifying covert advertisements. The dataset includes samples categorized as advertisements (label=1) and non-advertisements (label=0).
 
 
 
40
 
41
- ## Dataset Format
42
 
43
- The dataset is provided in an optimized parquet format:
 
 
 
 
 
 
 
 
 
44
 
45
- ```
46
- parquet_data_optimized/
47
- ├── train.parquet # Training set
48
- ├── validation.parquet # Validation set
49
- └── test.parquet # Test set
50
- ```
51
-
52
- Images are stored in a structured directory system:
53
-
54
- ```
55
- processed_images/
56
- ├── images_0000/ # Image subfolder 0
57
- ├── images_0001/ # Image subfolder 1
58
- └── ... # Additional image subfolders
59
- ```
60
-
61
- Each image is named following the pattern `post_{id}_img_{index}.jpg`, where:
62
-
63
- - `id` is the unique numeric identifier of the post
64
- - `index` is the image index within that post
65
-
66
- The parquet files contain the following fields:
67
-
68
- - `id`: Numeric sample identifier (sequentially assigned)
69
- - `title`: Post title
70
- - `description`: Post description content
71
- - `date`: Published date and location
72
- - `comments`: List of comments (as array)
73
- - `images`: List of image paths relative to processed_images directory
74
- - `image_count`: Number of images in the post
75
- - `label`: Classification label (0: non-advertisement, 1: advertisement)
76
- - `split`: Dataset split (train, validation, test)
77
-
78
- ## Dataset Statistics
79
-
80
- - **Total samples**: 4,992 samples
81
- - **Class distribution**:
82
- - Non-advertisements (label=0): 4,379 samples (87.7%)
83
- - Advertisements (label=1): 613 samples (12.3%)
84
- - **Splits**:
85
- - Training set: 3,493 samples
86
- - Validation set: 499 samples
87
- - Test set: 1,000 samples
88
- - **Images**: 26,324 images in total
89
- - **Average images per post**: 5.27 images
90
-
91
- ## Usage
92
-
93
- ### Loading Parquet Data
94
 
95
  ```python
96
  import pandas as pd
97
 
98
- # Load training set
99
- train_df = pd.read_parquet("parquet_data_optimized/train.parquet")
100
 
101
- # View data
102
- print(train_df.head())
103
- print(f"Training samples: {len(train_df)}")
104
-
105
- # Access images
106
- print(f"First sample images: {train_df.iloc[0]['images']}")
107
- print(f"Image count: {train_df.iloc[0]['image_count']}")
108
  ```
109
 
110
- ### Accessing Images
 
 
111
 
112
  ```python
113
- import os
 
114
  from PIL import Image
115
- import matplotlib.pyplot as plt
116
 
117
- # Function to load and display an image
118
- def load_and_display_image(image_path, base_dir="processed_images"):
119
- full_path = os.path.join(base_dir, image_path)
120
- img = Image.open(full_path)
121
- plt.figure(figsize=(10, 8))
122
- plt.imshow(img)
123
- plt.axis('off')
124
- plt.title(f"Image: {image_path}")
125
- plt.show()
126
 
127
- # Example: load the first image of the first post in the training set
128
- if len(train_df) > 0 and len(train_df.iloc[0]['images']) > 0:
129
- first_image_path = train_df.iloc[0]['images'][0]
130
- load_and_display_image(first_image_path)
131
- ```
132
-
133
- ## Citation
134
-
135
- If you use the CHASM dataset, please cite:
136
-
137
- ```
138
- @misc{CHASM2023,
139
- author = {Jingyi},
140
- title = {CHASM: Covert Advertisement on RedNote},
141
- year = {2023},
142
- publisher = {Hugging Face},
143
- howpublished = {\url{https://huggingface.co/datasets/Jingyi77/CHASM-Covert_Advertisement_on_RedNote}}
144
- }
145
  ```
 
1
+ # RedNote广告检测数据集
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ 此数据集包含RedNote平台上的帖子,用于广告检测任务。
4
 
5
+ ## 数据集结构
6
 
7
+ 数据集分为三个部分:
8
+ - `train.parquet`: 训练集
9
+ - `validation.parquet`: 验证集
10
+ - `test.parquet`: 测试集
11
 
12
+ ## 字段说明
13
 
14
+ 每个parquet文件包含以下字段:
15
+ - `id`: 帖子唯一标识符
16
+ - `title`: 帖子标题
17
+ - `description`: 帖子描述内容
18
+ - `date`: 发布日期(格式:月-日)
19
+ - `comments`: 评论列表
20
+ - `images`: 图像的base64编码列表
21
+ - `image_count`: 图像数量
22
+ - `label`: 标签(0=非广告,1=广告)
23
+ - `split`: 数据分割(train/validation/test)
24
 
25
+ ## 使用方法
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ```python
28
  import pandas as pd
29
 
30
+ # 读取训练集
31
+ train_df = pd.read_parquet("train.parquet")
32
 
33
+ # 查看数据
34
+ print(f"训练集样本数: {len(train_df)}")
35
+ print(f"标签分布: {train_df['label'].value_counts()}")
 
 
 
 
36
  ```
37
 
38
+ ## 图像处理
39
+
40
+ 图像以base64编码形式存储,可以使用以下代码解码:
41
 
42
  ```python
43
+ import base64
44
+ import io
45
  from PIL import Image
 
46
 
47
+ # 获取第一个样本的第一张图像
48
+ base64_str = train_df.iloc[0]['images'][0]
 
 
 
 
 
 
 
49
 
50
+ # 解码base64并显示图像
51
+ img_data = base64.b64decode(base64_str)
52
+ img = Image.open(io.BytesIO(img_data))
53
+ img.show()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ```