You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by smurching <gi...@git.apache.org> on 2018/01/24 22:40:36 UTC

[GitHub] spark pull request #20389: [SPARK-23205][ML] Update ImageSchema.readImages t...

GitHub user smurching opened a pull request:

    https://github.com/apache/spark/pull/20389

    [SPARK-23205][ML] Update ImageSchema.readImages to correctly set alpha values for four-channel images

    ## What changes were proposed in this pull request?
    
    When parsing raw image data in ImageSchema.decode(), we use a [java.awt.Color](https://docs.oracle.com/javase/7/docs/api/java/awt/Color.html#Color(int)) constructor that sets alpha = 255, even for four-channel images (which may have different alpha values). This PR fixes this issue & adds a unit test to verify correctness of reading four-channel images.
    
    ## How was this patch tested?
    
    Updates an existing unit test ("readImages pixel values test" in `ImageSchemaSuite`) to also verify correctness when reading a four-channel image.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/smurching/spark image-schema-bugfix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/20389.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #20389
    
----
commit 054c1dd457e5c95872a188f7978f678d7c7093d5
Author: Sid Murching <si...@...>
Date:   2018-01-24T22:34:08Z

    Bugfix + test

----


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test FAILed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/86609/
    Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    It's minor, though that cuts two ways - low risk to merge, but not critical. I think that's a moderately important issue for this module and a clean fix so I'd put it in branch 2.3


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86645 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86645/testReport)** for PR 20389 at commit [`8f1286e`](https://github.com/apache/spark/commit/8f1286e0a5d3434a84ee7a05bf04bcc3f267ea08).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/207/
    Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #20389: [SPARK-23205][ML] Update ImageSchema.readImages t...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20389#discussion_r163756581
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/image/ImageSchema.scala ---
    @@ -169,8 +169,7 @@ object ImageSchema {
             var offset = 0
             for (h <- 0 until height) {
               for (w <- 0 until width) {
    -            val color = new Color(img.getRGB(w, h))
    -
    +            val color = new Color(img.getRGB(w, h), nChannels == 4)
    --- End diff --
    
    Why don't directly use `hasAlpha`?


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/86645/
    Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/86607/
    Test FAILed.


---

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


[GitHub] spark pull request #20389: [SPARK-23205][ML] Update ImageSchema.readImages t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/20389


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86609 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86609/testReport)** for PR 20389 at commit [`4ec463e`](https://github.com/apache/spark/commit/4ec463e2272c119190131c07676eebde3d401ac5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86607 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86607/testReport)** for PR 20389 at commit [`054c1dd`](https://github.com/apache/spark/commit/054c1dd457e5c95872a188f7978f678d7c7093d5).


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86607 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86607/testReport)** for PR 20389 at commit [`054c1dd`](https://github.com/apache/spark/commit/054c1dd457e5c95872a188f7978f678d7c7093d5).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by smurching <gi...@git.apache.org>.
Github user smurching commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Thanks for the reviews @srowen, @dongjoon-hyun! Would it make sense to merge this before Spark 2.3 is released & if so would one of you be able to do so?


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86609 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86609/testReport)** for PR 20389 at commit [`4ec463e`](https://github.com/apache/spark/commit/4ec463e2272c119190131c07676eebde3d401ac5).


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged to master/2.3


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark pull request #20389: [SPARK-23205][ML] Update ImageSchema.readImages t...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20389#discussion_r163756853
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/image/ImageSchema.scala ---
    @@ -169,8 +169,7 @@ object ImageSchema {
             var offset = 0
             for (h <- 0 until height) {
               for (w <- 0 until width) {
    -            val color = new Color(img.getRGB(w, h))
    -
    +            val color = new Color(img.getRGB(w, h), nChannels == 4)
                 decoded(offset) = color.getBlue.toByte
                 decoded(offset + 1) = color.getGreen.toByte
                 decoded(offset + 2) = color.getRed.toByte
    --- End diff --
    
    At line 177,
    
    ```scala
    if (nChannels == 4) {
      decoded(offset + 3) = color.getAlpha.toByte
    }
    ```
    
    We can directly use `hasAlpha` too, instead of indirectly comparing `nChannels`.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/208/
    Test PASSed.


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    **[Test build #86645 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/86645/testReport)** for PR 20389 at commit [`8f1286e`](https://github.com/apache/spark/commit/8f1286e0a5d3434a84ee7a05bf04bcc3f267ea08).


---

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


[GitHub] spark issue #20389: [SPARK-23205][ML] Update ImageSchema.readImages to corre...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20389
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/236/
    Test PASSed.


---

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