Show layer type in name.
This commit is contained in:
@@ -49,14 +49,22 @@ const std::vector<boost::shared_ptr<caffe::Blob<DType>>>& LayerInfo::parameters(
|
|||||||
|
|
||||||
std::ostream &fmri::operator<<(std::ostream &out, LayerInfo::Type type)
|
std::ostream &fmri::operator<<(std::ostream &out, LayerInfo::Type type)
|
||||||
{
|
{
|
||||||
for (auto i : LayerInfo::NAME_TYPE_MAP) {
|
return out << LayerInfo::nameByType(type);
|
||||||
if (i.second == type) {
|
}
|
||||||
out << i.first;
|
|
||||||
return out;
|
std::string_view LayerInfo::nameByType(LayerInfo::Type type)
|
||||||
|
{
|
||||||
|
static std::unordered_map<Type, std::string_view> typeMap;
|
||||||
|
if (typeMap.empty()) {
|
||||||
|
for (auto item : LayerInfo::NAME_TYPE_MAP) {
|
||||||
|
typeMap[item.second] = item.first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "ERROR! UNSUPPORTED TYPE";
|
try {
|
||||||
return out;
|
return typeMap.at(type);
|
||||||
|
} catch (std::out_of_range&) {
|
||||||
|
return "ERROR! UNSUPPORTED TYPE";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ namespace fmri
|
|||||||
const std::vector<boost::shared_ptr<caffe::Blob<DType>>>& parameters() const;
|
const std::vector<boost::shared_ptr<caffe::Blob<DType>>>& parameters() const;
|
||||||
|
|
||||||
static Type typeByName(std::string_view name);
|
static Type typeByName(std::string_view name);
|
||||||
|
static std::string_view nameByType(Type type);
|
||||||
friend std::ostream& operator<<(std::ostream& out, Type type);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<boost::shared_ptr<caffe::Blob<DType>>> parameters_;
|
std::vector<boost::shared_ptr<caffe::Blob<DType>>> parameters_;
|
||||||
|
|||||||
@@ -109,7 +109,10 @@ static void renderLayerName(const LayerData &data)
|
|||||||
{
|
{
|
||||||
// Draw the name of the layer for reference.
|
// Draw the name of the layer for reference.
|
||||||
glColor3f(0.5, 0.5, 0.5);
|
glColor3f(0.5, 0.5, 0.5);
|
||||||
renderText(data.name());
|
auto layerName = data.name();
|
||||||
|
layerName += ": ";
|
||||||
|
layerName += LayerInfo::nameByType(rendererData.layerInfo.at(data.name()).type());
|
||||||
|
renderText(layerName);
|
||||||
|
|
||||||
glTranslatef(0, 0, -10);
|
glTranslatef(0, 0, -10);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user