def test_getunpaired(self): a, ac = utils.MimickDataset().get_unpaired_ultrasound_dataset(domain='iq', batch_size=1) b, bc = utils.MimickDataset().get_unpaired_ultrasound_dataset(domain='dtce', batch_size=1) for x,z1 in a: break for y,z2 in b: break assert x is not None assert y is not None assert z1 is not None assert z2 is not None
def test_shape(self): mimick_dataset = utils.MimickDataset(shape=(256, 256)) train_dataset, train_count = mimick_dataset.get_paired_ultrasound_dataset(batch_size=1) for x,y,z in train_dataset: break assert x.shape == (1, 256, 256, 1) assert y.shape == (1, 256, 256, 1)
def test_getpaired_v2(self): mimick_dataset = utils.MimickDataset() train_dataset, train_count = mimick_dataset.get_paired_ultrasound_dataset( csv='gs://duke-research-us/mimicknet/data/training-v2.csv', batch_size=1 ) for x,y,z in train_dataset: break assert x.shape == y.shape
def test_getunpaired_v2(self): a, ac = utils.MimickDataset().get_unpaired_ultrasound_dataset( domain='iq', batch_size=1, csv='gs://duke-research-us/mimicknet/data/training-v2-verasonics.csv' ) b, bc = utils.MimickDataset().get_unpaired_ultrasound_dataset( domain='dtce', batch_size=1, csv='gs://duke-research-us/mimicknet/data/training-v2-clinical.csv' ) for x,z1 in a: break for y,z2 in b: break assert x is not None assert y is not None assert z1 is not None assert z2 is not None
def test_getpaired(self): mimick_dataset = utils.MimickDataset() train_dataset, train_count = mimick_dataset.get_paired_ultrasound_dataset(batch_size=1) for x,y,z in train_dataset: break assert x.shape == y.shape
See the License for the specific language governing permissions and limitations under the License. """ import tensorflow as tf from trainer.config import config from trainer import utils from trainer import models from trainer import callbacks LOG_DIR = config.job_dir MODEL_DIR = config.model_dir # Load Data (Build your custom data loader and replace below) mimick = utils.MimickDataset(clipping=(config.clipping, 0), image_dir=config.image_dir, shape=(config.in_h, config.in_w)) iq_dataset, iq_count = mimick.get_unpaired_ultrasound_dataset( domain='iq', csv=config.train_das_csv, batch_size=config.bs) iq_dataset = iq_dataset.map(lambda x, z: x) dtce_dataset, dtce_count = mimick.get_unpaired_ultrasound_dataset( domain='dtce', csv=config.train_clinical_csv, batch_size=config.bs) dtce_dataset = dtce_dataset.map(lambda x, z: x) validation_dataset, val_count = mimick.get_paired_ultrasound_dataset( csv=config.validation_csv, batch_size=config.bs) validation_dataset = validation_dataset.map(lambda x, y, z: (x, y)) test_dataset, test_count = mimick.get_paired_ultrasound_dataset(