Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Clojure package remove source images (#15828)
Browse files Browse the repository at this point in the history
* remove test images

* add script and .gitignore

* add test helper to download images

* remove unlicensed pic

* add license header
  • Loading branch information
gigasquid authored and roywei committed Aug 11, 2019
1 parent 614cba3 commit 57927a9
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 2 deletions.
1 change: 1 addition & 0 deletions contrib/clojure-package/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ test/test-symbol.clj
test/test-symbol-random.clj
test/test-symbol-random-api.clj
test/test-symbol-api.clj
test/test-images/*
src/org/apache/clojure_mxnet/gen/*

Binary file not shown.
33 changes: 33 additions & 0 deletions contrib/clojure-package/scripts/get_test_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -evx

MXNET_ROOT=$(cd "$(dirname $0)/.."; pwd)

image_path=$MXNET_ROOT/test/test-images

if [ ! -d "$image_path" ]; then
mkdir -p "$image_path"
fi

if [ ! -f "$image_path/kitten.jpg" ]; then
wget https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci/resnet152/kitten.jpg -P $image_path
wget https://s3.amazonaws.com/model-server/inputs/Pug-Cookie.jpg -P $image_path
fi
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
(:require [org.apache.clojure-mxnet.image :as image]
[org.apache.clojure-mxnet.ndarray :as ndarray]
[clojure.java.io :as io]
[clojure.test :refer [deftest is use-fixtures]])
[clojure.test :refer [deftest is use-fixtures run-tests]]
[test-helper])
(:import (javax.imageio ImageIO)
(java.io File)))


(test-helper/load-test-images)

(def tmp-dir (System/getProperty "java.io.tmpdir"))
(def image-path (.getAbsolutePath (io/file tmp-dir "Pug-Cookie.jpg")))
(def image-src-path "test/test-images/Pug-Cookie.jpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
[org.apache.clojure-mxnet.ndarray :as ndarray]
[clojure.java.io :as io]
[clojure.java.shell :refer [sh]]
[clojure.test :refer :all]))
[clojure.test :refer :all]
[test-helper]))

(test-helper/load-test-images)

(def model-dir "data/")
(def model-path-prefix (str model-dir "resnet-18/resnet-18"))
Expand Down
Binary file not shown.
Binary file removed contrib/clojure-package/test/test-images/kitten.jpg
Binary file not shown.
26 changes: 26 additions & 0 deletions contrib/clojure-package/test/test_helper.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;; Licensed to the Apache Software Foundation (ASF) under one or more
;; contributor license agreements. See the NOTICE file distributed with
;; this work for additional information regarding copyright ownership.
;; The ASF licenses this file to You under the Apache License, Version 2.0
;; (the "License"); you may not use this file except in compliance with
;; the License. You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;;


(ns test-helper
(:require [clojure.java.io :as io]
[clojure.java.shell :refer [sh]]))

(def data-dir "test/test-images/")

(defn load-test-images []
(when-not (.exists (io/file (str data-dir "Pug-Cookie.jpg")))
(sh "./scripts/get_test_images.sh")))

0 comments on commit 57927a9

Please sign in to comment.