File size: 1,753 Bytes
6c6d384
 
 
ab3802c
6c6d384
 
 
ab3802c
 
6c6d384
 
a81a136
 
 
 
6c6d384
b0d31f1
6c6d384
b0d31f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
dataset_info:
  features:
  - name: original_image
    dtype: image
  - name: prompt
    dtype: string
  - name: transformed_image
    dtype: image
  splits:
  - name: train
    num_bytes: 604990210.0
    num_examples: 994
  download_size: 604849707
  dataset_size: 604990210.0
---
# Canny DiffusionDB 

This dataset is the [DiffusionDB dataset](https://huggingface.co/datasets/poloclub/diffusiondb) that is transformed using Canny transformation.

You can see samples below 👇 

**Sample:**

Original Image:
![image](https://datasets-server.huggingface.co/assets/merve/canny_diffusiondb/--/merve--canny_diffusiondb/train/0/original_image/image.jpg)
Transformed Image:
![image](https://datasets-server.huggingface.co/assets/merve/canny_diffusiondb/--/merve--canny_diffusiondb/train/0/transformed_image/image.jpg)
Caption:	
"a small wheat field beside a forest, studio lighting, golden ratio, details, masterpiece, fine art, intricate, decadent, ornate, highly detailed, digital painting, octane render, ray tracing reflections, 8 k, featured, by claude monet and vincent van gogh "

Below you can find a small script used to create this dataset:
```python

def canny_convert(image):
  image_array = np.array(image)
  gray_image = cv2.cvtColor(image_array, cv2.COLOR_BGR2GRAY)
  edges = cv2.Canny(gray_image, 100, 200)
  edge_image = Image.fromarray(edges)
  return edge_image

dataset = load_dataset("poloclub/diffusiondb", split = "train")

dataset_list = []
for data in dataset:

  image_path = data["image"]
  prompt = data["prompt"]
  transformed_image_path = canny_convert(image_path)

  new_data = {
      "original_image": image,
      "prompt": prompt,
      "transformed_image": transformed_image,
  }
  dataset_list.append(new_data)

```