7d9db23a389499c2764fb850cd19f853cc3e8565,ludwig/features/image_feature.py,ImageBaseFeature,add_feature_data,#Any#Any#Any#Any#Any#,192
Before Change
(num_images, height, width, num_channels),
dtype=np.uint8
)
for i in range(len(dataset_df)):
filepath = get_abs_path(
csv_path,
dataset_df[feature["name"]][i]
)
img = ImageBaseFeature._read_image_and_resize(
filepath,
width,
height,
should_resize,
num_channels,
preprocessing_parameters["resize_method"],
user_specified_num_channels
)
try:
data[feature["name"]][i, :, :, :] = img
except:
logger.error(
"Images are not of the same size. "
"Expected size is {}, "
"current image size is {}."
"Images are expected to be all of the same size"
"or explicit image width and height are expected"
"to be provided. "
"Additional information: https://uber.github.io/ludwig/user_guide///image-features-preprocessing"
.format(first_image.shape, img.shape)
)
raise
else:
data_fp = os.path.splitext(dataset_df.csv)[0] + ".hdf5"
mode = "w"
if os.path.isfile(data_fp):
After Change
dtype=np.uint8
)
with Pool(5) as pool:
logger.info("Using 5 processes for preprocessing images")
data[feature["name"]] = np.array(
pool.map(read_image_and_resize, all_file_paths)
)
else:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: uber/ludwig
Commit Name: 7d9db23a389499c2764fb850cd19f853cc3e8565
Time: 2019-08-08
Author: smiryala@uber.com
File Name: ludwig/features/image_feature.py
Class Name: ImageBaseFeature
Method Name: add_feature_data
Project Name: MTG/freesound
Commit Name: 0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2
Time: 2017-11-10
Author: andres.ferraro@upf.edu
File Name: search/management/commands/reindex_solr.py
Class Name: Command
Method Name: handle
Project Name: uber/ludwig
Commit Name: 5667af96dade79ef77194d519182d4989494b3a4
Time: 2019-08-25
Author: smiryala@uber.com
File Name: ludwig/features/image_feature.py
Class Name: ImageBaseFeature
Method Name: add_feature_data