2017-11-16 35 views
5

मैं ऑब्जेक्ट डिटेक्शन एपीआई, विशेष रूप से random_image_scale की डेटा एग्मेंटेशन सुविधाओं का उपयोग करने का प्रयास कर रहा हूं।ऑब्जेक्ट डिटेक्शन एपीआई में डेटा एग्मेंटेशन: random_image_scale

थोड़ा सा खोना मुझे यह क्रिया कार्यान्वित करने के लिए मिला (नीचे चिपकाया गया)। मुझे कुछ याद आ रही है या बक्से की जमीन की सच्चाई का इलाज नहीं किया जाता है? मैंने चारों ओर देखा है और कुछ भी नहीं मिला है। यदि छवि के अनुसार किए गए स्केलिंग के अनुसार ग्राउंड सच्चाई को संशोधित नहीं किया गया है, तो यह प्रशिक्षित मॉडल के साथ गड़बड़ कर देगा, है ना?

अगर मुझे कुछ याद आ रहा है या मुझे अपने नेटवर्क को प्रशिक्षित करने के लिए इस सुविधा से बचना चाहिए तो कृपया मुझे बताएं।

फ़ाइल /object_detection/core/preprocessor.py

def random_image_scale(image, 
         masks=None, 
         min_scale_ratio=0.5, 
         max_scale_ratio=2.0, 
         seed=None): 
    """Scales the image size. 

    Args: 
    image: rank 3 float32 tensor contains 1 image -> [height, width, channels]. 
    masks: (optional) rank 3 float32 tensor containing masks with 
     size [height, width, num_masks]. The value is set to None if there are no 
     masks. 
    min_scale_ratio: minimum scaling ratio. 
    max_scale_ratio: maximum scaling ratio. 
    seed: random seed. 

    Returns: 
    image: image which is the same rank as input image. 
    masks: If masks is not none, resized masks which are the same rank as input 
     masks will be returned. 
    """ 
    with tf.name_scope('RandomImageScale', values=[image]): 
    result = [] 
    image_shape = tf.shape(image) 
    image_height = image_shape[0] 
    image_width = image_shape[1] 
    size_coef = tf.random_uniform([], 
            minval=min_scale_ratio, 
            maxval=max_scale_ratio, 
            dtype=tf.float32, seed=seed) 
    image_newysize = tf.to_int32(
     tf.multiply(tf.to_float(image_height), size_coef)) 
    image_newxsize = tf.to_int32(
     tf.multiply(tf.to_float(image_width), size_coef)) 
    image = tf.image.resize_images(
     image, [image_newysize, image_newxsize], align_corners=True) 
    result.append(image) 
    if masks: 
     masks = tf.image.resize_nearest_neighbor(
      masks, [image_newysize, image_newxsize], align_corners=True) 
     result.append(masks) 
    return tuple(result) 
+0

विभिन्न घूर्णन का उपयोग कर डेटा को बढ़ाने के लिए कोई कोड नहीं है? –

उत्तर

1

आप एक tfrecord फ़ाइल का उपयोग कर रहे हैं, तो है, बॉक्स सीमाओं पूर्ण पिक्सल है, लेकिन रिश्तेदार प्रतिशत नहीं हैं। इसलिए यदि आप छवि को स्केल करते हैं, तो बक्से वही रहते हैं।

तो इसका उपयोग ठीक होना चाहिए।

+0

कोड के अनुसार, केवल पैमाने, चमक और कुछ पैड विकल्प हैं। रोटेशन के बारे में क्या? डेटा वृद्धि के लिए, मैं डेटा इनपुट करने से पहले इसे मैन्युअल रूप से करना पसंद करता हूं (प्रत्येक नमूना घुमाया जाता है, स्केल करता है इसलिए मुझे अधिक डेटा मिलता है)। –

संबंधित मुद्दे