cytometer/data.py
def remove_poor_data(datasets, prefix='mask', threshold=1000):
    """
    Find images where the mask has very few pixels, and remove them from the datasets. Training
    with them can decrease the performance of the model.
    :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets().
    :param prefix: (def 'mask') string. The number of pixels will be assessed in datasets[prefix].
    :param threshold: (def 1000) integer. Masks
    :return:
    """

    # indices of masks with a large enough number of pixels==1
    idx = np.count_nonzero(datasets[prefix], axis=(1, 2, 3)) > threshold
    # remove corresponding images from all datasets
    for prefix in datasets.keys():
        datasets[prefix] = datasets[prefix][idx, ...]

    return datasets

    Find images where the mask has very few pixels, and remove them from the datasets. Training
    with them can decrease the performance of the model.
    :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets().
    :param prefix: (def 'mask') string. The number of pixels will be assessed in datasets[prefix].
    :param threshold: (def 1000) integer. Masks
    :return:
    
Find images where the mask has very few pixels, and remove them from the datasets. Training
with them can decrease the performance of the model.
Find images where the mask has very few pixels and remove them from the datasets . Training with them can decrease the performance of the model .
def remove_poor_data(datasets, prefix='mask', threshold=1000):
    idx = np.count_nonzero(datasets[prefix], axis=(1, 2, 3)) > threshold
    for prefix in datasets.keys():
        datasets[prefix] = datasets[prefix][idx, ...]
    return datasets
def remove_poor_data ( datasets , prefix = 'mask' , threshold = 1000 ) : idx = np . count_nonzero ( datasets [ prefix ] , axis = ( 1 , 2 , 3 ) ) > threshold for prefix in datasets . keys ( ) : datasets [ prefix ] = datasets [ prefix ] [ idx , ... ] return datasets
Find images where the mask has very few pixels, and remove them from the datasets.
Find images where the mask has very few pixels and remove them from the datasets .
"""
    Find images where the mask has very few pixels, and remove them from the datasets. Training
    with them can decrease the performance of the model.
    :param datasets: dictionary with numpy.ndarray datasets loaded with load_datasets().
    :param prefix: (def 'mask') string. The number of pixels will be assessed in datasets[prefix].
    :param threshold: (def 1000) integer. Masks
    :return:
    """ # indices of masks with a large enough number of pixels==1 # remove corresponding images from all datasets
None
datasets
dictionary with numpy.ndarray datasets loaded with load_datasets().
dictionary with numpy . ndarray datasets loaded with load_datasets () .
prefix
(def 'mask') string. The number of pixels will be assessed in datasets[prefix].
( def ' mask ' ) string . The number of pixels will be assessed in datasets [ prefix ] .
threshold
None