Commit ead1abec authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

adapt to config

parent 6ad10b10
......@@ -16,14 +16,3 @@ def main():
if __name__ == "__main__":
main()
import random
hash = random.getrandbits(128)
print("hash value: %032x" % hash)
uuid.uuid4().hex
......@@ -10,17 +10,11 @@ from osmaug.transformation.crop import crop
def collosm_function(params: Dict):
workdir = os.path.join(params['workdir'])
if not os.path.exists(workdir):
sys.exit('workdir does not exist: '+workdir)
imgdir = os.path.join(workdir,'osm')
if not os.path.exists(imgdir):
os.mkdir(imgdir)
augmdir = os.path.join(workdir,'augm')
if not os.path.exists(augmdir):
os.mkdir(augmdir)
datadir = os.path.join(workdir,'data')
if not os.path.exists(datadir):
os.mkdir(datadir)
resdir = os.path.join(params['resdir'])
res_data_dir = os.path.join(resdir,'tab')
res_img_dir = os.path.join(resdir,'img')
if not os.path.exists(resdir):
os.mkdir(resdir)
df = pd.read_csv(params['file']['name'],sep=',')
df['ID'] = df['ID'].apply(str)
zoom = pd.DataFrame.from_dict(params['osm'], orient='columns')
......@@ -30,14 +24,14 @@ def collosm_function(params: Dict):
for index, row in df.iterrows():
filename = row['ID']+'_zoom_'+row_zoom['zoom']+'.jpg'
print(filename)
img = img_as_float(io.imread(os.path.join(imgdir,filename)))
img = img_as_float(io.imread(os.path.join(workdir,filename)))
augm = augm_dict[params['augmentation']['augmentation']]
img = augm(img)
img = crop(img, delta=params['augmentation']['delta_pixel'])
filename_aug = str(uuid.uuid4().hex)+'_'+filename
Image.fromarray(img_as_ubyte(img)).save(os.path.join(augmdir,filename_aug))
Image.fromarray(img_as_ubyte(img)).save(os.path.join(res_img_dir,filename_aug))
filename_tmp.append(filename_aug)
filenames['z'+row_zoom["zoom"]] = filename_tmp
df_file = pd.DataFrame(filenames)
res = pd.concat([df.reset_index(drop=True), df_file], axis=1)
res.to_csv(os.path.join(datadir,'dataset.csv'))
res.to_csv(os.path.join(res_data_dir,'dataset.csv'))
......@@ -6,9 +6,7 @@ from osmaug.osm.map import make_bbox, load_map, map2png, png2jpg
def getosm_function(params: Dict):
driver_bin = params['driver_bin']
workdir = os.path.join(params['workdir'])
if not os.path.exists(workdir):
sys.exit('workdir does not exist: '+workdir)
resdir = os.path.join(workdir,"osm")
resdir = os.path.join(params['resdir'])
if not os.path.exists(resdir):
os.mkdir(resdir)
zoom = params['zoom']
......
......@@ -10,9 +10,7 @@ from osmaug.transformation.crop import crop
def augmosm_function(params: Dict):
workdir = os.path.join(params['workdir'])
if not os.path.exists(workdir):
sys.exit('workdir does not exist: '+workdir)
resdir = os.path.join(workdir,"augm")
resdir = os.path.join(params['resdir'])
if not os.path.exists(resdir):
os.mkdir(resdir)
files = pd.DataFrame.from_dict(params['files'], orient='columns')
......
......@@ -16,7 +16,7 @@ dev_requirements = []
setup(
name='osmaug',
version='0.02dev',
version='0.03dev',
author='Jean-Marie Lepioufle, Islen Vallejo',
author_email='jml@nilu.no, iv@nilu.no',
packages=[
......@@ -28,7 +28,7 @@ setup(
description='A package for getting OpenStreet Map pictures and implementing augmentation.',
long_description = long_description,
url='https://git.nilu.no/aqdl/osmaug',
python_requires='>=3.9',
python_requires='>=3.8',
install_requires=install_requires,
extras_require={
'dev': dev_requirements})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment