Skip to content

Commit

Permalink
Added random order to efd and regionprops
Browse files Browse the repository at this point in the history
  • Loading branch information
afoix committed Aug 8, 2024
1 parent 07bb89c commit a35490c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions scripts/shapeembed/efd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import types
import pyefd
import random
import logging
import argparse

Expand All @@ -14,14 +15,13 @@
def get_dataset(dataset_params):
# access the dataset
assert dataset_params.type == 'mask', f'unsupported dataset type {dataset_params.type}'
dataset = datasets.ImageFolder( dataset_params.path
, transform=transforms.Compose([
transforms.Grayscale(1)
, ImageToCoords(contour_size) ]))
raw_dataset = datasets.ImageFolder( dataset_params.path
, transform=transforms.Compose([
transforms.Grayscale(1)
, ImageToCoords(contour_size) ]))
dataset = [x for x in raw_dataset]
random.shuffle(dataset)
return dataset
#dataloader = bioimage_embed.lightning.DataModule(dataset, shuffle=True)
#dataloader.setup()
#return dataloader.test

def run_elliptic_fourier_descriptors(dataset, contour_size, logger):
# run efd on each image
Expand Down
8 changes: 4 additions & 4 deletions scripts/shapeembed/regionprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import types
import random
import logging
import argparse
from skimage import measure
Expand All @@ -13,11 +14,10 @@
def get_dataset(dataset_params):
# access the dataset
assert dataset_params.type == 'mask', f'unsupported dataset type {dataset_params.type}'
dataset = datasets.ImageFolder(dataset_params.path, transforms.Grayscale(1))
raw_dataset = datasets.ImageFolder(dataset_params.path, transforms.Grayscale(1))
dataset = [x for x in raw_dataset]
random.shuffle(dataset)
return dataset
#dataloader = bioimage_embed.lightning.DataModule(dataset, shuffle=True)
#dataloader.setup()
#return dataloader.test

def run_regionprops( dataset
, properties
Expand Down

0 comments on commit a35490c

Please sign in to comment.