Add datasets/fake/generate_dataset.py
This commit is contained in:
parent
408b7a2ba9
commit
876ce96a58
13
datasets/fake/generate_dataset.py
Normal file
13
datasets/fake/generate_dataset.py
Normal 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()
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user