Add datasets/fake/generate_dataset.py

This commit is contained in:
Benjamin Loison 2024-03-22 10:31:47 +01:00
parent 408b7a2ba9
commit 876ce96a58
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,13 @@
from PIL import Image
import numpy
IMAGE_SIZE = 64
MODE = 'L'
IImage = Image.new(MODE, (IMAGE_SIZE, IMAGE_SIZE))
I = IImage.load()
for y in range(IMAGE_SIZE):
for x in range(IMAGE_SIZE):
I[y, x] = numpy.random.normal(loc = 0, scale = 1, size = 1)
I.show()

View File

@ -1,5 +1,13 @@
import requests
from lxml import html
import os
DOWNLOAD = True
# An alternative for downloading would be something like:
# ```bash
# wget --reject 'index.html*' -l inf -nH --cut-dirs=2 --recursive --no-parent https://lesc.dinfo.unifi.it/VISION/dataset/
# ```
# but this would not only download `flat` images.
url = 'https://lesc.dinfo.unifi.it/VISION/dataset/'
@ -23,6 +31,8 @@ def getFolderEntries(url):
entries += [[entryName, entrySize]]
return entries
os.mkdir('dataset')
totalPhotoSizes = 0
phoneFolders = getFolderEntries(url)
for phoneFolder, _ in phoneFolders: