spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomasatdatabricks <...@git.apache.org>
Subject [GitHub] spark pull request #20168: [SPARK-22730][ML] Add ImageSchema support for non...
Date Tue, 09 Jan 2018 02:25:54 GMT
Github user tomasatdatabricks commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20168#discussion_r160306292
  
    --- Diff: python/pyspark/ml/tests.py ---
    @@ -1843,6 +1844,28 @@ def tearDown(self):
     
     class ImageReaderTest(SparkSessionTestCase):
     
    +    def test_ocv_types(self):
    +        ocvList = ImageSchema.ocvTypes
    +        self.assertEqual("Undefined", ocvList[0].name)
    +        self.assertEqual(-1, ocvList[0].mode)
    +        self.assertEqual("N/A", ocvList[0].dataType)
    +        for x in ocvList:
    +            self.assertEqual(x, ImageSchema.ocvTypeByName(x.name))
    +            self.assertEqual(x, ImageSchema.ocvTypeByMode(x.mode))
    +
    +    def test_conversions(self):
    +        ary_src = [[[1e7*random.random() for z in range(4)] for y in range(10)] for x
in range(10)]
    +        for ocvType in ImageSchema.ocvTypes:
    +            if ocvType.name == 'Undefined':
    +                continue
    +            x = [[ary_src[i][j][0:ocvType.nChannels]
    +                  for j in range(len(ary_src[0]))] for i in range(len(ary_src))]
    +            npary0 = np.array(x).astype(ocvType.nptype)
    --- End diff --
    
    good point, I'll change that.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message