簡體   English   中英

更快的RCNN tensorflow對象檢測API:處理大圖像

[英]Faster RCNN tensorflow object detection API : dealing with big images

我有大尺寸的圖像(6000x4000)。 我想訓練FasterRCNN來檢測相當小的物體(在150個像素之間)。 因此,出於記憶目的,我將圖像裁剪為1000x1000。 訓練還可以。 當我在1000x1000上測試模型時,結果非常好。 當我在6000x4000的圖像上測試模型時,結果非常糟糕......

我想這是區域提案步驟,但我不知道我做錯了什么(keep_aspect_ratio_resizer max_dimension修復為12000)...

謝謝你的幫助 !

您需要繼續訓練圖像和圖像,以便在大致相同的維度上進行測試。 如果您使用隨機調整大小作為數據擴充,則可以大致通過該因子更改測試圖像。

解決此問題的最佳方法是將大圖像裁剪為與訓練中使用的相同維度的圖像,然后對作物使用非最大抑制來合並預測。

這樣,如果要檢測的最小物體大小為50px,則可以獲得大小為~500px的訓練圖像。

在我看來,你正在訓練的圖像具有與你所測試的不同的寬高比(正方形與非正方形) - 這可能導致質量顯着下降。

雖然說實話我有點驚訝,結果可能真的很糟糕,如果你只是在視覺上評估,也許你還必須調低可視化的分數閾值。

我想知道你的min_dimension在你的情況下應該大於4000,否則圖像將縮小。

object_detection-> core-> preprocessor.py

def _compute_new_dynamic_size(image, min_dimension, max_dimension): """Compute new dynamic shape for resize_to_range method.""" image_shape = tf.shape(image) orig_height = tf.to_float(image_shape[0]) orig_width = tf.to_float(image_shape[1]) orig_min_dim = tf.minimum(orig_height, orig_width) # Calculates the larger of the possible sizes min_dimension = tf.constant(min_dimension, dtype=tf.float32) large_scale_factor = min_dimension / orig_min_dim # Scaling orig_(height|width) by large_scale_factor will make the smaller # dimension equal to min_dimension, save for floating point rounding errors. # For reasonably-sized images, taking the nearest integer will reliably # eliminate this error. large_height = tf.to_int32(tf.round(orig_height * large_scale_factor)) large_width = tf.to_int32(tf.round(orig_width * large_scale_factor)) large_size = tf.stack([large_height, large_width]) if max_dimension: # Calculates the smaller of the possible sizes, use that if the larger # is too big. orig_max_dim = tf.maximum(orig_height, orig_width) max_dimension = tf.constant(max_dimension, dtype=tf.float32) small_scale_factor = max_dimension / orig_max_dim # Scaling orig_(height|width) by small_scale_factor will make the larger # dimension equal to max_dimension, save for floating point rounding # errors. For reasonably-sized images, taking the nearest integer will # reliably eliminate this error. small_height = tf.to_int32(tf.round(orig_height * small_scale_factor)) small_width = tf.to_int32(tf.round(orig_width * small_scale_factor)) small_size = tf.stack([small_height, small_width]) new_size = tf.cond( tf.to_float(tf.reduce_max(large_size)) > max_dimension, lambda: small_size, lambda: large_size) else: new_size = large_size return new_size

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM