TensorFlow.NET.Samples/ImageProcessing/RetrainImageClassifierTransferLearningTFNET.cs
/// <summary>
/// Ensures all the training, testing, and validation bottlenecks are cached.
/// </summary>
/// <param name="sess"></param>
/// <param name="image_lists"></param>
/// <param name="image_dir"></param>
/// <param name="bottleneck_dir"></param>
/// <param name="jpeg_data_tensor"></param>
/// <param name="decoded_image_tensor"></param>
/// <param name="resized_image_tensor"></param>
/// <param name="bottleneck_tensor"></param>
/// <param name="tfhub_module"></param>
Ensures all the training, testing, and validation bottlenecks are cached.
Ensures all the training testing and validation bottlenecks are cached .
private void cache_bottlenecks(Session sess, Dictionary<string, Dictionary<string, string[]>> image_lists,
            string image_dir, string bottleneck_dir, Tensor jpeg_data_tensor, Tensor decoded_image_tensor,
            Tensor resized_input_tensor, Tensor bottleneck_tensor, string module_name)
        {
            int how_many_bottlenecks = 0;
            foreach (var (label_name, label_lists) in image_lists)
            {
                foreach (var category in new string[] { "training", "testing", "validation" })
                {
                    var category_list = label_lists[category];
                    foreach (var (index, unused_base_name) in enumerate(category_list))
                    {
                        get_or_create_bottleneck(sess, image_lists, label_name, index, image_dir, category,
                            bottleneck_dir, jpeg_data_tensor, decoded_image_tensor,
                            resized_input_tensor, bottleneck_tensor, module_name);
                        how_many_bottlenecks++;
                        if (how_many_bottlenecks % 300 == 0)
                            print($"{how_many_bottlenecks} bottleneck files created.");
                    }
                }
            }
        }
private void cache_bottlenecks ( Session sess , Dictionary < string , Dictionary < string , string [ ] > > image_lists , string image_dir , string bottleneck_dir , Tensor jpeg_data_tensor , Tensor decoded_image_tensor , Tensor resized_input_tensor , Tensor bottleneck_tensor , string module_name ) { int how_many_bottlenecks = 0 ; foreach ( var ( label_name , label_lists ) in image_lists ) { foreach ( var category in new string [ ] { " " , " " , " " } ) { var category_list = label_lists [ category ] ; foreach ( var ( index , unused_base_name ) in enumerate ( category_list ) ) { get_or_create_bottleneck ( sess , image_lists , label_name , index , image_dir , category , bottleneck_dir , jpeg_data_tensor , decoded_image_tensor , resized_input_tensor , bottleneck_tensor , module_name ) ; how_many_bottlenecks ++ ; if ( how_many_bottlenecks % 300 == 0 ) print ( $" { how_many_bottlenecks }  bottleneck files created. " ) ; } } } }
Ensures all the training, testing, and validation bottlenecks are cached.
Ensures all the training testing and validation bottlenecks are cached .
sess
Session
None
image_lists
Dictionary<string, Dictionary<string, string[]>>
None
image_dir
string
None
bottleneck_dir
string
None
jpeg_data_tensor
Tensor
None
decoded_image_tensor
Tensor
None
resized_input_tensor
Tensor
bottleneck_tensor
Tensor
None
module_name
string
resized_image_tensor
None
tfhub_module
None