Author: koji
Date: Wed Dec 19 02:41:52 2012
New Revision: 1423736
URL: http://svn.apache.org/viewvc?rev=1423736&view=rev
Log:
add build.xml for demo and move demo targets to the demo ant build
Added:
labs/alike/trunk/demo/build.xml
Modified:
labs/alike/trunk/build.xml
labs/alike/trunk/demo/README.txt
labs/alike/trunk/demo/run_desc_extractor.py
Modified: labs/alike/trunk/build.xml
URL:
http://svn.apache.org/viewvc/labs/alike/trunk/build.xml?rev=1423736&r1=1423735&r2=1423736&view=diff
==============================================================================
--- labs/alike/trunk/build.xml (original)
+++ labs/alike/trunk/build.xml Wed Dec 19 02:41:52 2012
@@ -20,7 +20,8 @@
<project name="apache-alike" xmlns:ivy="antlib:org.apache.ivy.ant"
default="alike-compile" basedir=".">
- <property file="build.properties"/>
+ <dirname property="mybase.dir" file="${ant.file.apache-alike}"/>
+ <property file="${mybase.dir}/build.properties"/>
<path id="common.path.lib">
<fileset dir="${lib.dir}" includes="*.jar"/>
@@ -32,8 +33,8 @@
<target name="resolve" description="retrieve dependencies with ivy">
<ivy:retrieve/>
</target>
-
- <target name="alike-compile" depends="resolve" description="compile
alike">
+
+ <target name="alike-compile" depends="resolve" description="compile alike">
<mkdir dir="${cls.dir}"/>
<javac srcdir="${src.dir}/java"
destdir="${cls.dir}"
@@ -128,26 +129,6 @@
<!-- ================================================================== -->
<!-- = LAUNCH TOOLS = -->
<!-- ================================================================== -->
- <mkdir dir="demo/input-vectors"/>
-
- <target name="run-piv" depends="alike-compile" description="run
PrepareInputVectors">
- <java classname="org.apache.alike.PrepareInputVectors" fork="true">
- <jvmarg line="-Dfile.encoding=UTF-8"/>
- <arg line="demo/desc demo/input-vectors/data"/>
- <classpath refid="common.path.lib"/>
- <classpath path="${cls.dir}"/>
- </java>
- </target>
-
- <target name="run-qv" depends="alike-compile" description="run
PrepareInputVectors">
- <java classname="org.apache.alike.QuantizeVectors" fork="true">
- <jvmarg line="-Dfile.encoding=UTF-8"/>
- <arg line="demo/desc demo/result-centroids.txt
demo/solr-demo-data.xml"/>
- <classpath refid="common.path.lib"/>
- <classpath path="${cls.dir}"/>
- </java>
- </target>
-
<target name="run-clustering" depends="alike-compile" description="run
Clustering">
<java classname="org.apache.alike.Clustering" fork="true">
<jvmarg line="-Dfile.encoding=UTF-8"/>
@@ -170,15 +151,6 @@
</delete>
</target>
- <target name="clean-demo" description="clean intermediate files in demo
directory">
- <delete dir="demo/input-vectors"/>
- <delete dir="demo/init-clusters"/>
- <delete dir="demo/output-clusters"/>
- <delete>
- <fileset dir="demo" includes="result-centroids.txt"/>
- </delete>
- </target>
-
<target name="clean-lib" description="clean libs downloaded by ivy">
<delete dir="${lib.dir}"/>
</target>
Modified: labs/alike/trunk/demo/README.txt
URL:
http://svn.apache.org/viewvc/labs/alike/trunk/demo/README.txt?rev=1423736&r1=1423735&r2=1423736&view=diff
==============================================================================
--- labs/alike/trunk/demo/README.txt (original)
+++ labs/alike/trunk/demo/README.txt Wed Dec 19 02:41:52 2012
@@ -27,52 +27,41 @@
$ tar xvzf 101_ObjectCategories.tar.gz
-4. remove existing subdirectories of desc directory before running extoractor
+4. remove existing intermediate and result files of demo
- $ rm -Rf desc/*
+ $ ant clean
5. run extractor program
$ export PYTHONPATH=../src/python; python run_desc_extractor.py
-6. run clustering
+6. run clustering and vector quantization programs
- # go to parent directory and run PrepareInputVectors via ant
- $ cd ..
- $ ant run-piv
-
- # go back to demo directory and run kmeans (it may take several minutes)
- $ cd demo
- $ mahout kmeans -i input-vectors -c init-clusters -o output-clusters -k 500
--maxIter 50 -cd 0.001
-
- # then run clusterdump
+ $ ant piv
+ # kmeans may take several minutes
+ $ mahout kmeans -i input-vectors -c init-clusters -o output-clusters -k 500
--maxIter 50 -cd 0.01
$ mahout clusterdump -i $(find output-clusters -name \*-final) -o
result-centroids.txt
+ $ ant qv
-7. run vector quantization program
-
- # go to parent directory and run QuantizeVectors via ant
- $ cd ..
- $ ant run-qv
-
-8. goto Solr site, download Solr 4.0 and unzip
+7. goto Solr site, download Solr 4.0 or superior and unzip
- # Apache Solr web site
+ # Apache Solr web site and download apache-solr-4.0.0.tgz or superior
http://lucene.apache.org/solr/
# unzip
$ tar xvzf apache-solr-4.0.0.tgz
-9. startup Solr server
+8. startup Solr server
$ cd apache-solr-4.0.0/example
$ java -Dsolr.solr.home=../../solrhome -jar start.jar
-10. index demo vector quantization data
+9. index demo vector quantization data
$ ./post.sh solr-demo-data.xml
-11. startup demo web server
+10. startup demo web server
$ python demoserver.py
-12. access to http://localhost:8080/ in your web browser and enjoy the demo!
+11. access to http://localhost:8080/ in your web browser and enjoy the demo!
Added: labs/alike/trunk/demo/build.xml
URL:
http://svn.apache.org/viewvc/labs/alike/trunk/demo/build.xml?rev=1423736&view=auto
==============================================================================
--- labs/alike/trunk/demo/build.xml (added)
+++ labs/alike/trunk/demo/build.xml Wed Dec 19 02:41:52 2012
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project name="alike-demo" xmlns:ivy="antlib:org.apache.ivy.ant"
+ default="piv" basedir="..">
+
+ <import file="../build.xml"/>
+
+ <target name="piv" depends="alike-compile" description="run
PrepareInputVectors">
+ <java classname="org.apache.alike.PrepareInputVectors" fork="true">
+ <jvmarg line="-Dfile.encoding=UTF-8"/>
+ <arg line="demo/desc demo/input-vectors/data"/>
+ <classpath refid="common.path.lib"/>
+ <classpath path="${cls.dir}"/>
+ </java>
+ </target>
+
+ <target name="qv" depends="alike-compile" description="run
PrepareInputVectors">
+ <java classname="org.apache.alike.QuantizeVectors" fork="true">
+ <jvmarg line="-Dfile.encoding=UTF-8"/>
+ <arg line="demo/desc demo/result-centroids.txt
demo/solr-demo-data.xml"/>
+ <classpath refid="common.path.lib"/>
+ <classpath path="${cls.dir}"/>
+ </java>
+ </target>
+
+ <!-- overriding imported clean target -->
+ <target name="clean" description="clean intermediate and result files of
demo">
+ <delete dir="demo/input-vectors"/>
+ <delete dir="demo/init-clusters"/>
+ <delete dir="demo/output-clusters"/>
+ <delete dir="demo/solrhome/collection1/data"/>
+ <delete includeemptydirs="true">
+ <fileset dir="demo/desc" includes="**/*"/>
+ <fileset dir="demo" includes="result-centroids.txt"/>
+ </delete>
+ </target>
+
+</project>
Modified: labs/alike/trunk/demo/run_desc_extractor.py
URL:
http://svn.apache.org/viewvc/labs/alike/trunk/demo/run_desc_extractor.py?rev=1423736&r1=1423735&r2=1423736&view=diff
==============================================================================
--- labs/alike/trunk/demo/run_desc_extractor.py (original)
+++ labs/alike/trunk/demo/run_desc_extractor.py Wed Dec 19 02:41:52 2012
@@ -18,7 +18,7 @@ import desc_extractor as de
IMAGES_DIR = '101_ObjectCategories'
SUB_DIRS = ['Faces', 'dollar_bill', 'chair', 'cougar_face', 'elephant',
'car_side']
-MAX_IMGS = 50
+MAX_IMGS = 100
for sub_dir in SUB_DIRS:
isd = IMAGES_DIR + '/' + sub_dir
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]