0

使用Tensorflow 1.3我可以访问Event_acumulator重新加载保存的事件:

>>> dir(event_acc)
['Audio', 'CompressedHistograms', 'FirstEventTimestamp', 'Graph', 'Histograms', 'Images', 'MetaGraph', 'PluginAssets', 'PluginTagToContent', 'Reload', 'RetrievePluginAsset', 'RunMetadata', 'Scalars', 'SummaryMetadata', 'Tags', 'Tensors', '_CheckForOutOfOrderStepAndMaybePurge', '_CheckForRestartAndMaybePurge', '_CompressHistogram', '_ConvertHistogramProtoToTuple', '_MaybePurgeOrphanedData', '_ProcessAudio', '_ProcessEvent', '_ProcessHistogram', '_ProcessImage', '_ProcessScalar', '_ProcessTensor', '_Purge', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_compression_bps', '_first_event_timestamp', '_generator', '_generator_mutex', '_graph', '_graph_from_metagraph', '_meta_graph', '_plugin_to_tag_to_content', '_tagged_metadata', '_tensor_summaries', 'accumulated_attrs', 'audios', 'compressed_histograms', 'file_version', 'histograms', 'images', 'most_recent_step', 'most_recent_wall_time', 'path', 'purge_orphaned_data', 'scalars', 'summary_metadata', 'tensors']

它具有示例冻结模型的以下标签:

>>> type(event_acc.Tags)
<type 'instancemethod'>

>>>type(event_acc.Tags())
<type 'dict'>

>>> dir(event_acc.Tags())
['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues']

打印它会带来这个:

>>> pprint(event_acc.Tags())
{'audio': [],
 'distributions': [u'MobilenetV1/Conv2d_5_depthwise/BatchNorm/moving_variance_1',
                   u'activations/Conv2d_4_depthwise',
                   u'MobilenetV1/Conv2d_4_depthwise/BatchNorm/moving_mean_1',
                   u'activations/Conv2d_8_depthwise',
...
 'graph': True,
 'histograms': [u'MobilenetV1/Conv2d_5_depthwise/BatchNorm/moving_variance_1',
                u'activations/Conv2d_4_depthwise',
                u'MobilenetV1/Conv2d_4_depthwise/BatchNorm/moving_mean_1',
                u'activations/Conv2d_8_depthwise',
                u'MobilenetV1/Conv2d_2_depthwise/BatchNorm/moving_mean_1',
...
 'images': [u'distort_image/cropped_resized_image/image/0',
            u'distort_image/images_with_distorted_bounding_box/image/0',
            u'distort_image/final_distorted_image/image/0',
            u'distort_image/image_with_bounding_boxes/image/0'],
 'meta_graph': True,
 'run_metadata': [],
 'scalars': [u'sparsity/Conv2d_13_pointwise',
             u'sparsity/Conv2d_6_depthwise',
...
            u'sparsity/Conv2d_11_depthwise',
             u'global_step/sec'],
 'tensors': []}

我似乎没有找到一种方法来打印'distributions'标签内数组中特定变量的值。例如:这样的东西Tags.Distribution('X')不起作用,因为它不存在于它的目录中。但是,打印标签说有对应于“分布”的数组。任何想法?

4

1 回答 1

1

你没有打电话typeevent_acc.Tags()这本来很有用。不过,大概考虑到打印输出和方法列表,它似乎只是返回了一个普通的字典。所以你可以简单地做event_acc.Tags()['distributions']

于 2017-09-15T17:22:39.477 回答