Commit 9b1c46f336aa40ebc2af238214864825997d0e46
1 parent
a895f0bf
more helpful missing key errors
Showing
2 changed files
with
6 additions
and
7 deletions
openbr/core/eval.cpp
| @@ -464,11 +464,10 @@ QList<Detection> getDetections(QString key, const Template &t, bool isList, bool | @@ -464,11 +464,10 @@ QList<Detection> getDetections(QString key, const Template &t, bool isList, bool | ||
| 464 | dets.append(Detection(rects.at(i), confidences.at(i))); | 464 | dets.append(Detection(rects.at(i), confidences.at(i))); |
| 465 | } | 465 | } |
| 466 | } else { | 466 | } else { |
| 467 | - if (isTruth) { | 467 | + if (isTruth) |
| 468 | dets.append(Detection(f.get<QRectF>(key))); | 468 | dets.append(Detection(f.get<QRectF>(key))); |
| 469 | - } else { | 469 | + else |
| 470 | dets.append(Detection(f.get<QRectF>(key), f.get<float>("Confidence", -1))); | 470 | dets.append(Detection(f.get<QRectF>(key), f.get<float>("Confidence", -1))); |
| 471 | - } | ||
| 472 | } | 471 | } |
| 473 | return dets; | 472 | return dets; |
| 474 | } | 473 | } |
openbr/openbr_plugin.h
| @@ -233,9 +233,9 @@ struct BR_EXPORT File | @@ -233,9 +233,9 @@ struct BR_EXPORT File | ||
| 233 | template <typename T> | 233 | template <typename T> |
| 234 | T get(const QString &key) const | 234 | T get(const QString &key) const |
| 235 | { | 235 | { |
| 236 | - if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); | 236 | + if (!contains(key)) qFatal("Missing key: %s in: %s", qPrintable(key), qPrintable(flat())); |
| 237 | QVariant variant = value(key); | 237 | QVariant variant = value(key); |
| 238 | - if (!variant.canConvert<T>()) qFatal("Can't convert: %s", qPrintable(key)); | 238 | + if (!variant.canConvert<T>()) qFatal("Can't convert: %s in: %s", qPrintable(key), qPrintable(flat())); |
| 239 | return variant.value<T>(); | 239 | return variant.value<T>(); |
| 240 | } | 240 | } |
| 241 | 241 | ||
| @@ -256,11 +256,11 @@ struct BR_EXPORT File | @@ -256,11 +256,11 @@ struct BR_EXPORT File | ||
| 256 | template <typename T> | 256 | template <typename T> |
| 257 | QList<T> getList(const QString &key) const | 257 | QList<T> getList(const QString &key) const |
| 258 | { | 258 | { |
| 259 | - if (!contains(key)) qFatal("Missing key: %s", qPrintable(key)); | 259 | + if (!contains(key)) qFatal("Missing key: %s in: %s", qPrintable(key), qPrintable(flat())); |
| 260 | QList<T> list; | 260 | QList<T> list; |
| 261 | foreach (const QVariant &item, m_metadata[key].toList()) { | 261 | foreach (const QVariant &item, m_metadata[key].toList()) { |
| 262 | if (item.canConvert<T>()) list.append(item.value<T>()); | 262 | if (item.canConvert<T>()) list.append(item.value<T>()); |
| 263 | - else qFatal("Failed to convert value for key %s.", qPrintable(key)); | 263 | + else qFatal("Failed to convert value for key %s in: %s", qPrintable(key), qPrintable(flat())); |
| 264 | } | 264 | } |
| 265 | return list; | 265 | return list; |
| 266 | } | 266 | } |