diff --git a/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.image_dataset_from_directory.cs b/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.image_dataset_from_directory.cs
index 4acae426..f42d12cd 100644
--- a/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.image_dataset_from_directory.cs
+++ b/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.image_dataset_from_directory.cs
@@ -58,6 +58,7 @@ namespace Tensorflow.Keras
if (shuffle)
dataset = dataset.shuffle(batch_size * 8, seed: seed);
dataset = dataset.batch(batch_size);
+ dataset.class_names = class_name_list;
return dataset;
}
diff --git a/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.paths_and_labels_to_dataset.cs b/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.paths_and_labels_to_dataset.cs
index b4d58387..eaa762d8 100644
--- a/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.paths_and_labels_to_dataset.cs
+++ b/src/TensorFlowNET.Keras/Preprocessings/Preprocessing.paths_and_labels_to_dataset.cs
@@ -6,6 +6,31 @@ namespace Tensorflow.Keras
{
public partial class Preprocessing
{
+
+ ///
+ /// 图片路径转为数据处理用的dataset
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 用于调整大小的插值方法。支持`bilinear`、`nearest`、`bicubic`、`area`、`lanczos3`、`lanczos5`、`gaussian`、`mitchellcubic`。
+ /// 默认为`'bilinear'`。
+ ///
+ ///
+ public IDatasetV2 paths_to_dataset(string[] image_paths,
+ Shape image_size,
+ int num_channels = 3,
+ int num_classes = 6,
+ string interpolation = "bilinear")
+ {
+ var path_ds = tf.data.Dataset.from_tensor_slices(image_paths);
+ var img_ds = path_ds.map(x => path_to_image(x, image_size, num_channels, interpolation));
+ var label_ds = dataset_utils.labels_to_dataset(new int[num_classes] , "", num_classes);
+
+ return img_ds;
+ }
+
public IDatasetV2 paths_and_labels_to_dataset(string[] image_paths,
Shape image_size,
int num_channels,