Android layout tips

via http://www.cnblogs.com/youxilua/archive/2012/05/08/2489414.html

1.没有一劳永逸的方案!

有经常关注android官方文档的,一定知道在android4.0发布不久,官方就推出了一套UI设计教程,

官方原版:Android Design

非官方简体中文版: 非官方简体中文版

6寸e-ink pdf版: 6寸版本

有人会说,这不是UI设计吗?这是美工和设计干的事情,跟我们这些程序猿有什么关系!严重跑题!!!

关于一个程序猿要不要懂点设计,这个问题,不做讨论,不过,个人经验,有时候,可能因此而灵感闪现,解决了一个不大不小的问题.

很多人都尝试在屏幕设配上,找出一条通用的解决方案,可惜的是,就算是官方也没法提供这样的帮助, 更别说我们这些苦逼的程序员,这里有个小故事,大家都知道Instagram android版吧,有个采访,Instagram的初始人就说,我每天收到最多的用户反馈就是为什么不能在他的android手机上运行,但是,我已经设配了几百个android手机了!!!

所以,想找出一条康庄大道几乎是不太可能的事情,不过,我们可以修内功,出现问题,不可怕,可怕的是出现问题无法解决,接下来,我就谈谈关于屏幕设配的一些经验之谈.

2.这世界究竟有多少种屏幕?

我们每天都在究竟怎么去设配屏幕,那么这世上有多少屏幕要让我们去设配呢?下面应用了一个官方的最新资料:有兴趣的可以直接到:官方统计的屏幕分布

取之2012/5/7

chart

ldpi     mdpi     hdpi     xhdpi
small     2.3%         2.4%
normal     0.7%     26.2%     57.8%     0.9%
large     0.3%     2%
xlarge         7.4%

很多人第一次看这个图的时候肯定会感到疑惑,怎么不是分辨率?

这是什么鬼数据,这让人怎么去设配屏幕!买手机的时候可没有人会说”你好,我要一个Normal大小屏幕,密度最好是hdpi的手机”.

描述过于模糊!!!这可能是为什么设配android屏幕是一件很困难的事情,关于什么是Normal,什么是hdpi,如果,不清楚这点朋友,我建议先去看看官方文档:Supporting Multiple Screens 有些东西竟然官方竟然告诉了我们,为啥还要去重复呢?

顺便推荐一个算DPI的在线小工具:DPI Calculator / PPI Calculator 大概计算一下,当前分辨率的手机处于哪个区间里面,至于详情,我还是建议大家去看一下官方文档,里面已经说得很清楚了!!

竟然,官方文档都写好了,还有你写来干嘛啊!那么接下来就开始说一些开发碰到的问题.

3.开始布一个局

1,新建一个android项目,把新建一个Activity那个选项选上!然后用模拟器运行项目!什么?!!

你没看错,记住照着做就没错了…因为,今天,我们要讲如何优化和兼容View ,所以,一切从研究View开始!

2,打开hierarchyviewer

这是一个帮助我们优化view的非常重要的工具的,接下来的大部分时间,都会借住这个工具进行讲解,这个工具沉睡在android sdk 目录 tools下 hierarchyviewer.bat,或者用Everything这样的搜索硬盘的工具直接找到!

3,分析

还记得我们第一步运行的项目吗?接着用hierarchyviewer这样的神器,就可以导出这样的图!

H

这么一张图就是我们一个Hello,World项目的View 布局结构,在HierarchyViewer上你点击每个按钮就会有非常详细的布局信息,所以,这里对于hierarchyViewer的介绍到此为止!关于这个工具的详细使用,请查阅Debugging and Profiling User Interfaces 这里不做赘述!

  4,如何布好一个局?

关于这点我在开发中总结了一下几点

1.熟读API文档!

布局这东西不是比酷的东西,不是比谁的布局越复杂,那个人就越牛叉,以最少的步骤完成,设计图的要求,这应该是每个android开发程序员的宗旨!!

案例一:做一个带箭头的返回按钮

经理:那个小与啊,你根据这设计图搞一个按钮

image

小与:这还不简单三分钟搞定

于是小于程序猿,敲下了如下代码

<RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/btn_headtita"
            android:textColor="#ffffff"
            android:text="@string/back" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:src="@drawable/header_back" />

    </RelativeLayout>

看代码多累啊,我们用刚刚介绍的hierarchyviewer来分析一下,这个按钮有什么问题!

image

我们从这个图中,我们可以看到,为了这么一个按钮我们用了view的三个节点去完成!假设,我们的一个view 有三个类似的按钮就意味着我们要用9个节点去完成,我们可以简单得出这是一个3N级的复杂度布局,我们可以尝试去优化吗?

技巧一:熟读官方的API文档!

个人建议,常用的Widget的所有参数都尽量了解一遍!在阅读官方文档的时候我们发现了Button,有一个可以把图绘制在左边的参数:android:drawableLeft

于是,我们优化了一下小与的代码

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_headtita"
        android:drawableLeft="@drawable/header_back"
        android:gravity="center"
        android:padding="10dp"
        android:text="@string/back"
        android:textColor="#ffffff" />

用hierarchyviewer来分析一下image

瞬间一个3N级复杂度的布局,变成了一个N级复杂的!所以,我建议各位android开发朋友,在考虑优化的时候先把api文档里面的内容烂熟与心,不然,这样折腾下去,很浪费时间!

有细心的朋友可能会问:android:padding=”10dp”  这个用来做什么了?

我先告诉大家,不用这个参数:你将会看到:

image

用了以后:

image

这下大家能够明白了吧?

所以,当你在进行布局的时候,如果碰到比较繁琐的时候,你先想想会不会已经API本身就有这样的参数呢?

简单是所有布局开始最重要的原则!

简单意味着不容易出现兼容问题!

简单意味着性能不错!

2.模块化布局

480x800_MarkMan

所谓,模块化布局就是要你熟悉使用<include /> 这个标签!

一个经典的Tab类布局由三部分组成,我们可以根据这三部分创建三个可以重用的布局

head_menu.xml

content_showweibo.xml

bottom_menu.xml

然后我们可以很灵活的组合我们要显示的,例如要完成上面的那个weibo布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
      android:orientation="vertical"
     >
 <include android:id="@+id/head_menu" layout="@layout/head_menu" />
 <include android:id="@+id/content" layout="@layout/content_showweibo" />
 <include android:id="@+id/bottom_menu" layout="@layout/bottom_menu" />

</LinearLayout>

熟练的使用<include />标签就可以大大的减少我们日后都维护工作!

3.合并没必要的节点

还记得我们一开始的那个项目吗?

image

在高效布局里面,有一条准则就是,尽量的减少节点!!!!如图,我们发现,其实LinearLayout其实啥都没干,我们却耗费了那么一点性能去绘制了这么没用的节点!

接下来,我们为了消灭这个节点,我们需要一个这么的标签

<merge ></merge>

修改咱们的代码让它,性能更好!

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_headtita"
        android:drawableLeft="@drawable/header_back"
        android:gravity="center"
        android:layout_gravity="center_vertical|center_horizontal"
        android:padding="10dp"
        android:text="@string/back"
        android:textColor="#ffffff" />

</merge>

打开hierarchyviewer 一看!

image

哦也!优化了一个节点!并且显示快了那么一点点...

 5.总结

讲了,这么一大堆东西,貌似,没怎么如何去优化?都是在说一些操作性的东西,其实,这世上没有绝对的优化方案,所谓的优化方案都是基于一个最初的基本原则出发,例如,内存用得再少一点!那么如何才能将这内存用得再少一点做的了,这样就需要一些最基本的方法,关于布局这部分的基本方法,我在上面已经很详细的说了一遍了,当进行布局的时候你要牢记

1,尽量使用view自身的参数

2,减少一个布局的不必要节点

3,尽量重用一个布局文件

兼容问题呢?兼容问题出现的原因千奇百怪,没有一套通用的法则!关于这点谈一下自己的看法

1,减少复杂度,往往,兼容问题的出现,就是布局太复杂了,例如,我举的那个按钮布局,本来一个View就能完成,你却用了三个view完成,在使用的时候,出现问题的概念也大幅度提升!所以,布局以简单为本,那样兼容问题就可以尽量避免!

2,熟练使用工具,还记得hierarchyviewer 吗?当出现兼容问题的时候,用这个软件可以快速定位到错误位置!

 

Advertisements

Android 联网功能

Android 基于 Linux® 内核,包含一组优秀的联网功能。

Android是由互联网巨头Google带头开发的,因此对网络功能的支持是必不可少的。Google的应用层采用的是Java语言。所以JAVA支持的网络编程方式Android都支持,同时Google还引入了Apache 的HTTP扩展包。另外,针对WIFI,NFC,分别提供的单独的开发API.

表 1. Android SDK 网络包

描述
java.net 提供与联网有关的类,包括流和数据包(datagram)sockets、Internet 协议和常见 HTTP 处理。该包是一个多功能网络资源。有经验的 Java 开发人员可以立即使用这个熟悉的包创建应用程序。
java.io 虽然没有提供显式的联网功能,但是仍然非常重要。该包中的类由其他 Java 包中提供的 socket 和连接使用。它们还用于与本地文件(在与网络进行交互时会经常出现)的交互。
java.nio 包含表示特定数据类型的缓冲区的类。适合用于两个基于 Java 语言的端点之间的通信。
org.apache.* 表示许多为 HTTP 通信提供精确控制和功能的包。可以将 Apache 视为流行的开源 Web 服务器。
android.net 除核心 java.net.* 类以外,包含额外的网络访问 socket。该包包括 URI 类,后者频繁用于 Android 应用程序开发,而不仅仅是传统的联网方面。
android.net.http 包含处理 SSL 证书的类。
android.net.wifi 包含在 Android 平台上管理有关 WiFi(802.11 无线 Ethernet)所有方面的类。并不是所有设备都配备了 WiFi 功能,特别是 Android 在 Motorola 和 LG 等手机制造商的 “翻盖手机” 领域获得了成功。
android.telephony.gsm 包含用于管理和发送 SMS(文本)消息的类。一段时间后,可能会引入额外的包来来为非 GSM 网络提供类似的功能,比如 CDMA 或 android.telephony.cdma 等网络。

Android网络通信的六种方式示例代码

(1)针对TCP/IPSocket、ServerSocket
(2)针对UDPDatagramSocket、DatagramPackage。这里需要注意的是,考虑到Android设备通常是手持终端,IP都是随着上网进行分配的。不是固定的。因此开发也是有一点与普通互联网应用有所差异的。
(3)针对直接URL的HttpURLConnection
(4)Google集成了Apache HTTP客户端,可使用HTTP进行网络编程。针对HTTP,Google集成了Appache Http corehttpclient 4版本,因此特别注意Android不支持httpclient 3.x系列,而且目前并不支持Multipart(MIME),需要自行添加httpmime.jar 
(5)使用Web Service。Android可以通过开源包如jackson去支持Xmlrpc和Jsonrpc,另外也可以用Ksoap2去实现Webservice
(6) 直接使用WebView视图组件显示网页。基于WebView 进行开发,Google已经提供了一个基于chrome-lite的Web浏览器,直接就可以进行上网浏览网页。

1. 针对TCP/IP Socket、ServerSocket的形式

TCP/IP是一种协议,是一种面向连接的、可靠的协议。Socket仅仅是对TCP、UDP网络接口的封装,不涉及上层协议。TCP、UDP传输特性不同,分别适用于不同类型的应用层协议,其中TCP有连接,延时较长,能保证服务质量;UDP无连接,需要应用程序进行数据分包、延时短,效率高,数据包可能丢失或到达对端发生顺序混乱。在Socket之上可以实现这些RFC标准的应用层协议,也可以自定义实现私有的应用层协议。

在JAVA编程中, 经常使用java.net和javax.net包来开发socket程序,下面列出所有常用的类,并简单介绍。关于详细的信息请参看JAVA文档。

Java.net
Java.net.Socket                            客户端连接使用的TCP socket
Java.net.DatagramSocket        客户端和服务端共同使用的UDP socket
Java.net.ServerSocket               服务端TCP socket监听端口
Java.netInetAddress                   IP地址封装类
Java.net.DataGramPacket        通过DatagramSocket收发的数据包的封装类,包括数据和对端的IP地址、UDP端口

Javax.net
Javax.net.SocketFactory                     客户端连接使用的T CP socket
Javax.net.ServerSocketFactory        服务端TCP socket监听端口
Javax.net.ssl.SSLSocketFactory        SSL客户端Socket构造器
Javax.net.ssl.SSLServerFactory        SSL服务端监听Socket构造器

示例代码: android+socket编程实例.rar

2. 针对UDP的DatagramSocket、DatagramPackage

  • 对于UDP服务端,首先启动侦听服务,然后得到数据包进行处理,组后根据获得数据包进行反馈。
  • UDP socket没有连接的概念,因此构造完成的DatagramSocket不会发出向对端的网络连接请求,在每一个发送的UDP数据包中包含目的地址和端口。因为UDP数据不会在对端进行重新组包,因此一次发送的数据长度必须加以限制。

Socket.send(outputPacket);用于发送一个数据包;socket.receive(inputPacket);用于接收一个数据包。

2.jpg

1.jpg

3. 针对直接URL的HttpURLConnection
这个就是把请求的方式从HttpClient换成HttpURLConnection就可以了。

1) 使用 标准Java接口: 设计的类: java.net.* 
基本步骤:
1) 创建 URL 以及 URLConnection / HttpURLConnection 对象 

  • 对于 HTTP 连接可以直接转换成 HttpURLConnection,这样就可以使用一些 HTTP 连接特定的方法,如 setRequestMethod() 等:
  •    //HttpURLConnection connection =
  • (HttpURLConnection) url.openConnection(Proxy_yours);
  • 2) 设置连接参数 
    • 在开始和服务器连接之前,可能需要设置一些网络参数
  • connection.setConnectTimeout(10000);

3) 连接到服务器 

connection.connect();
4) 向服务器写数据

OutputStream outStream = connection.getOutputStream();

 ObjectOutputStream objOutput = new ObjectOutputStream(outStream);     

 objOutput.writeObject(new String(&quot;this is a string…&quot;));     

objOutput.flush();     

5)从服务器读取数据

InputStream in = connection.getInputStream();

2)使用 apache 接口:

Apache HttpClient 是一个开源项目,弥补了 java.net.* 灵活性不足的缺点, 支持客户端的HTTP编程.
使用的类包括:  org.apache.http.* 

步骤:
1) 创建 HttpClient 以及 GetMethod / PostMethod, HttpRequest 等对象;
2) 设置连接参数;
3) 执行 HTTP 操作;
4) 处理服务器返回结果.

try {
// 创建 HttpParams 以用来设置 HTTP 参数(这一部分不是必需的)
HttpParams params = new BasicHttpParams();
// 设置连接超时和 Socket 超时,以及 Socket 缓存大小:
HttpConnectionParams.setConnectionTimeout(params, 20 * 1000);
HttpConnectionParams.setSoTimeout(params, 20 * 1000);
HttpConnectionParams.setSocketBufferSize(params, 8192);
// 设置重定向,缺省为 true:
HttpClientParams.setRedirecting(params, true);
// 设置 user agent:
HttpProtocolParams.setUserAgent(params, userAgent);
// 创建一个 HttpClient 实例:
// 注意: HttpClient httpClient = new HttpClient(); 是Commons HttpClient中的用法,
// 在 Android 1.5 中我们需要使用 Apache 的缺省实现 DefaultHttpClient.
DefaultHttpClient httpClient = new DefaultHttpClient(params);
// 创建 HttpGet 方法,该方法会自动处理 URL 地址的重定向:
HttpGet httpGet = new HttpGet (&quot;http://www.test_test.com/&quot;);
//执行此方法:
HttpResponse response = client.execute(httpGet);
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
// 错误处理,例如可以在该请求正常结束前将其中断:
httpGet.abort();
}
// 读取更多信息
Header[] headers = response.getHeaders();
HttpEntity entity = response.getEntity();
Header header = response.getFirstHeader(&quot;Content-Type&quot;);
} catch (Exception ee) {
// ...
} finally {
// 释放连接:
client.getConnectionManager().shutdown();
}

3) 使用 android 接口: 
android.net.http.* 实际上是通过对 Apache 的 HttpClient 的封装来实现的一个 HTTP 编程接口,同时还提供了 HTTP 请求队列管理、以及 HTTP 连接池管理,以提高并发请求情况下(如转载网页时)的处理效率,除此之外还有网络状态监视等接口

try {
AndroidHttpClient client =
AndroidHttpClient.newInstance(“user_agent__my_mobile_browser”);
// 创建 HttpGet 方法,该方法会自动处理 URL 地址的重定向:
HttpGet httpGet = new HttpGet ("http://www.test_test.com/");
HttpResponse response = client.execute(httpGet);
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
// 错误处理...
}
//...
// 关闭连接:
client.close();
} catch (Exception ee) {
//...
}

四、Google集成了Apache HTTP客户端,可使用HTTP进行网络编程
这个不多说了,网络编程,必须会的。自己看代码吧。

  • 服务端我使用三种方式:S2SH、只用Struts2、Servlet
  • 客户端就一种,只不过换个请求的URL。
  • 服务端和客户端交互使用了两种方式:XML、JSON

目前开放平台返回的数据都是支持这两种数据格式的。所以我也实现了这两种数据格式。其实还有一种格式,就是google的protocal buffer,这种形式在国内用的人比较少,我也没弄,感兴趣的同学看我提供的文档,自己研究吧。注意把里面的IP换成自己电脑的IP地址

示例代码:
服务端:ServletTest1.rar、StrAnd.rar、WebAndroid.rar
客户端:WebAndroidClient.rar

a. 在只使用Struts2的服务器端,可以这么配置:
<package name=”struts-main” extends=”json-default” >
<action name=”*UserAction” method=”{1}”>
<result type=”json”></result>
</action>
</package>
也可以这么配置:
<package name=”struts-main” extends=”struts-default” >
<action name=”*UserAction” method=”{1}”>
<result name=”register”>/WEB-INF/page/register.jsp</result>
<result name=”save”>/WEB-INF/page/index.jsp</result>
</action>
</package>

但是其实返回数据的时候都是封装JSON字符串,没用到第一种形式的配置的功能。据说,用第一种配置方式,struts2可以自动把返回的数据封装成JSON字符串的形式,但是我没测试成功。。。。我返现返回什么格式还是什么格式,并没有把数据自动封装成JSON返回。
b. 在使用S2SH的服务端,就不能用第一种方式配置。只能用第二种方式,然后服务端封装JSON返回客户端。如果用第一种方式配置,就会发生404错误。无法找到服务器端。
c. 在使用Servlet的服务端,可以通过下面这种方式设置返回类型,但是其实没用,你设置了,它也不返回。你只能自己封装XML文件或者JSON字符串,然后返回。
response.setContentType(“application/json;charset=utf-8”);

android端和Struts2服务器端通信,交互信息,参数采用JSON,使用了HttpClient与HttpPost类

KSOAP2调用webserverice

五、使用Web Service
我之前只听说过什么是webservice,因此主要是参考下面文章实现的DEMO,他给出了一些实例代码,不全,我给基本补全了。显示天气信息我都在LOG输出了,没有显示在界面上,如果大家觉得不爽,可以把信息直接显示在界面上就可以了。因为我被这个问题困扰了2天,弄的很崩溃,所以就没继续弄。大家自己看吧。
那么什么是webService呢?,它是一种基于SAOP协议的远程调用标准,通过webservice可以将不同操作系统平台,不同语言,不同技术整合到一起。在Android中,第三方公司提供了基于webservice的jar包:ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar

Android与服务器端数据交互(基于SOAP协议整合android+webservice)

Android调用天气预报的WebService简单例子
示例代码:SoapAndroidTeset.rar、sserEx09.rar

六. 直接使用WebView视图组件显示网页
这就是使用webview显示网页的问题,比较容易,大家自己看吧。我就不贴实例代码了。

via 

Java网络编程

who cares? museum, visual art gallery

social engagement activities

detailed ethnographic observation and interviews about art-based participation and engagement

offer people (groups of culturally marginalised people) the possibility of finding new ways to represent their experiences and the quality of feeling they evoked

artwork extends the capacity for symbolisation – and hence communication- of hitherto unarticulated life worlds and internal worlds in such a way as to preserve their vitality.

  • The artist and participant meet or engage through the artwork.
  • The artwork becomes a cultural form for their experience; their ways of relating to one another; the things they say or do together; and the emotional quality of that exchange – including its pleasures, ambivalences and antagonisms.
  • In providing a form that shows what could not be said, experience is symbolised – brought into being in a new language.
  • The aesthetic third takes something that exists in the imagination of these who participate in its production or reception, and by finding a cultural form it that can be understood by others, is shared.
  • By enabling experience to be shared the aesthetic third creates a vital link between individual and community.

Visual arts engagement can be used to provide a foundation of skills and emotional development in order to empower people to change their situation, and can contribute to social regeneration and development in a meaningful and lasting way, if effectively utilised

The Importance of Fine Arts Education

Education in the arts is an integral part of the development of each human being.

Sufficient data exists to overwhelmingly support the belief that study and participation in the fine arts is a key component in improving learning throughout all academic areas. Evidence of its effectiveness in reducing student dropout, raising student attendance, developing better team players, fostering a love for learning, improving greater student dignity, enhancing student creativity, and producing a more prepared citizen for the workplace for tomorrow can be found documented in studies held in many varied settings, from school campuses, to corporate America.

The arts develop neural systems that produce a broad spectrum of benefits ranging from fine motor skills to creativity and improved emotional balance. One must realize that these systems often take months and even years to fine-tune.

The fine arts also provide learners with non-academic benefits such as promoting self-esteem, motivation, aesthetic awareness, cultural exposure, creativity, improved emotional expression, as well as social harmony and appreciation of diversity. These are the very fibers of the fabric known as our American culture.

 

 

 

 

 

 

 

 

 

 

How art can be good [zz]

December 2006  http://www.paulgraham.com/goodart.html

I grew up believing that taste is just a matter of personal preference. Each person has things they like, but no one’s preferences are any better than anyone else’s. There is no such thing as good taste.

Like a lot of things I grew up believing, this turns out to be false, and I’m going to try to explain why.

One problem with saying there’s no such thing as good taste is that it also means there’s no such thing as good art. If there were good art, then people who liked it would have better taste than people who didn’t. So if you discard taste, you also have to discard the idea of art being good, and artists being good at making it.

It was pulling on that thread that unravelled my childhood faith in relativism. When you’re trying to make things, taste becomes a practical matter. You have to decide what to do next. Would it make the painting better if I changed that part? If there’s no such thing as better, it doesn’t matter what you do. In fact, it doesn’t matter if you paint at all. You could just go out and buy a ready-made blank canvas. If there’s no such thing as good, that would be just as great an achievement as the ceiling of the Sistine Chapel. Less laborious, certainly, but if you can achieve the same level of performance with less effort, surely that’s more impressive, not less.

Yet that doesn’t seem quite right, does it?

Audience

I think the key to this puzzle is to remember that art has an audience. Art has a purpose, which is to interest its audience. Good art (like good anything) is art that achieves its purpose particularly well. The meaning of “interest” can vary. Some works of art are meant to shock, and others to please; some are meant to jump out at you, and others to sit quietly in the background. But all art has to work on an audience, and—here’s the critical point—members of the audience share things in common.

For example, nearly all humans find human faces engaging. It seems to be wired into us. Babies can recognize faces practically from birth. In fact, faces seem to have co-evolved with our interest in them; the face is the body’s billboard. So all other things being equal, a painting with faces in it will interest people more than one without. [1]

One reason it’s easy to believe that taste is merely personal preference is that, if it isn’t, how do you pick out the people with better taste? There are billions of people, each with their own opinion; on what grounds can you prefer one to another? [2]

But if audiences have a lot in common, you’re not in a position of having to choose one out of a random set of individual biases, because the set isn’t random. All humans find faces engaging—practically by definition: face recognition is in our DNA. And so having a notion of good art, in the sense of art that does its job well, doesn’t require you to pick out a few individuals and label their opinions as correct. No matter who you pick, they’ll find faces engaging.

Of course, space aliens probably wouldn’t find human faces engaging. But there might be other things they shared in common with us. The most likely source of examples is math. I expect space aliens would agree with us most of the time about which of two proofs was better. Erdos thought so. He called a maximally elegant proof one out of God’s book, and presumably God’s book is universal. [3]

Once you start talking about audiences, you don’t have to argue simply that there are or aren’t standards of taste. Instead tastes are a series of concentric rings, like ripples in a pond. There are some things that will appeal to you and your friends, others that will appeal to most people your age, others that will appeal to most humans, and perhaps others that would appeal to most sentient beings (whatever that means).

The picture is slightly more complicated than that, because in the middle of the pond there are overlapping sets of ripples. For example, there might be things that appealed particularly to men, or to people from a certain culture.

If good art is art that interests its audience, then when you talk about art being good, you also have to say for what audience. So is it meaningless to talk about art simply being good or bad? No, because one audience is the set of all possible humans. I think that’s the audience people are implicitly talking about when they say a work of art is good: they mean it would engage any human.[4]

And that is a meaningful test, because although, like any everyday concept, “human” is fuzzy around the edges, there are a lot of things practically all humans have in common. In addition to our interest in faces, there’s something special about primary colors for nearly all of us, because it’s an artifact of the way our eyes work. Most humans will also find images of 3D objects engaging, because that also seems to be built into our visual perception. [5]And beneath that there’s edge-finding, which makes images with definite shapes more engaging than mere blur.

Humans have a lot more in common than this, of course. My goal is not to compile a complete list, just to show that there’s some solid ground here. People’s preferences aren’t random. So an artist working on a painting and trying to decide whether to change some part of it doesn’t have to think “Why bother? I might as well flip a coin.” Instead he can ask “What would make the painting more interesting to people?” And the reason you can’t equal Michelangelo by going out and buying a blank canvas is that the ceiling of the Sistine Chapel is more interesting to people.

A lot of philosophers have had a hard time believing it was possible for there to be objective standards for art. It seemed obvious that beauty, for example, was something that happened in the head of the observer, not something that was a property of objects. It was thus “subjective” rather than “objective.” But in fact if you narrow the definition of beauty to something that works a certain way on humans, and you observe how much humans have in common, it turns out to be a property of objects after all. You don’t have to choose between something being a property of the subject or the object if subjects all react similarly. Being good art is thus a property of objects as much as, say, being toxic to humans is: it’s good art if it consistently affects humans in a certain way.

Error

So could we figure out what the best art is by taking a vote? After all, if appealing to humans is the test, we should be able to just ask them, right?

Well, not quite. For products of nature that might work. I’d be willing to eat the apple the world’s population had voted most delicious, and I’d probably be willing to visit the beach they voted most beautiful, but having to look at the painting they voted the best would be a crapshoot.

Man-made stuff is different. For one thing, artists, unlike apple trees, often deliberately try to trick us. Some tricks are quite subtle. For example, any work of art sets expectations by its level of finish. You don’t expect photographic accuracy in something that looks like a quick sketch. So one widely used trick, especially among illustrators, is to intentionally make a painting or drawing look like it was done faster than it was. The average person looks at it and thinks: how amazingly skillful. It’s like saying something clever in a conversation as if you’d thought of it on the spur of the moment, when in fact you’d worked it out the day before.

Another much less subtle influence is brand. If you go to see the Mona Lisa, you’ll probably be disappointed, because it’s hidden behind a thick glass wall and surrounded by a frenzied crowd taking pictures of themselves in front of it. At best you can see it the way you see a friend across the room at a crowded party. The Louvre might as well replace it with copy; no one would be able to tell. And yet the Mona Lisa is a small, dark painting. If you found people who’d never seen an image of it and sent them to a museum in which it was hanging among other paintings with a tag labelling it as a portrait by an unknown fifteenth century artist, most would walk by without giving it a second look.

For the average person, brand dominates all other factors in the judgement of art. Seeing a painting they recognize from reproductions is so overwhelming that their response to it as a painting is drowned out.

And then of course there are the tricks people play on themselves. Most adults looking at art worry that if they don’t like what they’re supposed to, they’ll be thought uncultured. This doesn’t just affect what they claim to like; they actually make themselves like things they’re supposed to.

That’s why you can’t just take a vote. Though appeal to people is a meaningful test, in practice you can’t measure it, just as you can’t find north using a compass with a magnet sitting next to it. There are sources of error so powerful that if you take a vote, all you’re measuring is the error.

We can, however, approach our goal from another direction, by using ourselves as guinea pigs. You’re human. If you want to know what the basic human reaction to a piece of art would be, you can at least approach that by getting rid of the sources of error in your own judgements.

For example, while anyone’s reaction to a famous painting will be warped at first by its fame, there are ways to decrease its effects. One is to come back to the painting over and over. After a few days the fame wears off, and you can start to see it as a painting. Another is to stand close. A painting familiar from reproductions looks more familiar from ten feet away; close in you see details that get lost in reproductions, and which you’re therefore seeing for the first time.

There are two main kinds of error that get in the way of seeing a work of art: biases you bring from your own circumstances, and tricks played by the artist. Tricks are straightforward to correct for. Merely being aware of them usually prevents them from working. For example, when I was ten I used to be very impressed by airbrushed lettering that looked like shiny metal. But once you study how it’s done, you see that it’s a pretty cheesy trick—one of the sort that relies on pushing a few visual buttons really hard to temporarily overwhelm the viewer. It’s like trying to convince someone by shouting at them.

The way not to be vulnerable to tricks is to explicitly seek out and catalog them. When you notice a whiff of dishonesty coming from some kind of art, stop and figure out what’s going on. When someone is obviously pandering to an audience that’s easily fooled, whether it’s someone making shiny stuff to impress ten year olds, or someone making conspicuously avant-garde stuff to impress would-be intellectuals, learn how they do it. Once you’ve seen enough examples of specific types of tricks, you start to become a connoisseur of trickery in general, just as professional magicians are.

What counts as a trick? Roughly, it’s something done with contempt for the audience. For example, the guys designing Ferraris in the 1950s were probably designing cars that they themselves admired. Whereas I suspect over at General Motors the marketing people are telling the designers, “Most people who buy SUVs do it to seem manly, not to drive off-road. So don’t worry about the suspension; just make that sucker as big and tough-looking as you can.” [6]

I think with some effort you can make yourself nearly immune to tricks. It’s harder to escape the influence of your own circumstances, but you can at least move in that direction. The way to do it is to travel widely, in both time and space. If you go and see all the different kinds of things people like in other cultures, and learn about all the different things people have liked in the past, you’ll probably find it changes what you like. I doubt you could ever make yourself into a completely universal person, if only because you can only travel in one direction in time. But if you find a work of art that would appeal equally to your friends, to people in Nepal, and to the ancient Greeks, you’re probably onto something.

My main point here is not how to have good taste, but that there can even be such a thing. And I think I’ve shown that. There is such a thing as good art. It’s art that interests its human audience, and since humans have a lot in common, what interests them is not random. Since there’s such a thing as good art, there’s also such a thing as good taste, which is the ability to recognize it.

If we were talking about the taste of apples, I’d agree that taste is just personal preference. Some people like certain kinds of apples and others like other kinds, but how can you say that one is right and the other wrong? [7]

The thing is, art isn’t apples. Art is man-made. It comes with a lot of cultural baggage, and in addition the people who make it often try to trick us. Most people’s judgement of art is dominated by these extraneous factors; they’re like someone trying to judge the taste of apples in a dish made of equal parts apples and jalapeno peppers. All they’re tasting is the peppers. So it turns out you can pick out some people and say that they have better taste than others: they’re the ones who actually taste art like apples.

Or to put it more prosaically, they’re the people who (a) are hard to trick, and (b) don’t just like whatever they grew up with. If you could find people who’d eliminated all such influences on their judgement, you’d probably still see variation in what they liked. But because humans have so much in common, you’d also find they agreed on a lot. They’d nearly all prefer the ceiling of the Sistine Chapel to a blank canvas.

Making It

I wrote this essay because I was tired of hearing “taste is subjective” and wanted to kill it once and for all. Anyone who makes things knows intuitively that’s not true. When you’re trying to make art, the temptation to be lazy is as great as in any other kind of work. Of course it matters to do a good job. And yet you can see how great a hold “taste is subjective” has even in the art world by how nervous it makes people to talk about art being good or bad. Those whose jobs require them to judge art, like curators, mostly resort to euphemisms like “significant” or “important” or (getting dangerously close) “realized.” [8]

I don’t have any illusions that being able to talk about art being good or bad will cause the people who talk about it to have anything more useful to say. Indeed, one of the reasons “taste is subjective” found such a receptive audience is that, historically, the things people have said about good taste have generally been such nonsense.

It’s not for the people who talk about art that I want to free the idea of good art, but for those who make it. Right now, ambitious kids going to art school run smack into a brick wall. They arrive hoping one day to be as good as the famous artists they’ve seen in books, and the first thing they learn is that the concept of good has been retired. Instead everyone is just supposed to explore their own personal vision. [9]

When I was in art school, we were looking one day at a slide of some great fifteenth century painting, and one of the students asked “Why don’t artists paint like that now?” The room suddenly got quiet. Though rarely asked out loud, this question lurks uncomfortably in the back of every art student’s mind. It was as if someone had brought up the topic of lung cancer in a meeting within Philip Morris.

“Well,” the professor replied, “we’re interested in different questions now.” He was a pretty nice guy, but at the time I couldn’t help wishing I could send him back to fifteenth century Florence to explain in person to Leonardo & Co. how we had moved beyond their early, limited concept of art. Just imagine that conversation.

In fact, one of the reasons artists in fifteenth century Florence made such great things was that they believed you could make great things[10] They were intensely competitive and were always trying to outdo one another, like mathematicians or physicists today—maybe like anyone who has ever done anything really well.

The idea that you could make great things was not just a useful illusion. They were actually right. So the most important consequence of realizing there can be good art is that it frees artists to try to make it. To the ambitious kids arriving at art school this year hoping one day to make great things, I say: don’t believe it when they tell you this is a naive and outdated ambition. There is such a thing as good art, and if you try to make it, there are people who will notice.

Notes

[1] This is not to say, of course, that good paintings must have faces in them, just that everyone’s visual piano has that key on it. There are situations in which you want to avoid faces, precisely because they attract so much attention. But you can see how universally faces work by their prevalence in advertising.

[2] The other reason it’s easy to believe is that it makes people feel good. To a kid, this idea is crack. In every other respect they’re constantly being told that they have a lot to learn. But in this they’re perfect. Their opinion carries the same weight as any adult’s. You should probably question anything you believed as a kid that you’d want to believe this much.

[3] It’s conceivable that the elegance of proofs is quantifiable, in the sense that there may be some formal measure that turns out to coincide with mathematicians’ judgements. Perhaps it would be worth trying to make a formal language for proofs in which those considered more elegant consistently came out shorter (perhaps after being macroexpanded or compiled).

[4] Maybe it would be possible to make art that would appeal to space aliens, but I’m not going to get into that because (a) it’s too hard to answer, and (b) I’m satisfied if I can establish that good art is a meaningful idea for human audiences.

[5] If early abstract paintings seem more interesting than later ones, it may be because the first abstract painters were trained to paint from life, and their hands thus tended to make the kind of gestures you use in representing physical things. In effect they were saying “scaramara” instead of “uebfgbsb.”

[6] It’s a bit more complicated, because sometimes artists unconsciously use tricks by imitating art that does.

[7] I phrased this in terms of the taste of apples because if people can see the apples, they can be fooled. When I was a kid most apples were a variety called Red Delicious that had been bred to look appealing in stores, but which didn’t taste very good.

[8] To be fair, curators are in a difficult position. If they’re dealing with recent art, they have to include things in shows that they think are bad. That’s because the test for what gets included in shows is basically the market price, and for recent art that is largely determined by successful businessmen and their wives. So it’s not always intellectual dishonesty that makes curators and dealers use neutral-sounding language.

[9] What happens in practice is that everyone gets really good attalking about art. As the art itself gets more random, the effort that would have gone into the work goes instead into the intellectual sounding theory behind it. “My work represents an exploration of gender and sexuality in an urban context,” etc. Different people win at that game.

[10] There were several other reasons, including that Florence was then the richest and most sophisticated city in the world, and that they lived in a time before photography had (a) killed portraiture as a source of income and (b) made brand the dominant factor in the sale of art.

Incidentally, I’m not saying that good art = fifteenth century European art. I’m not saying we should make what they made, but that we should work like they worked. There are fields now in which many people work with the same energy and honesty that fifteenth century artists did, but art is not one of them.

Thanks to Trevor Blackwell, Jessica Livingston, and Robert Morris for reading drafts of this, and to Paul Watson for permission to use the image at the top.

Engagement Mobile Media

relevant + connected + involved

While only a small slice wants to blog, a far larger swath is eager to make friends and contacts, to exchange pictures and music, to share activities and ideas.  — 2008

Consumers can no longer be considered ‘the audience’ – they are simultaneously readers, editors and marketers, especially the younger demographics.   —by IBM institute for Business value, 2009


spend

How do we consume multimedia?

The mobile phone has transcended its original role as a means of communication by serving a multitude of purposes.

  • How do you currently use your mobile?
  • What do you like about it? What do you

    hate about it? 

  • Has the mobile changed your life? If so, how?
  • Have you ever switched your provider and, if so, why?
  • What are the imperfections or disadvantages of the mobile lifestyle?
  • How do you spend your commuting time? If you use your phone while commuting, how do you use it?
  • What would you like to be able to do with your phone that you currently cannot?

Current Usage
Typical usage comprises voice conversation and short messaging. The most popular ‘nontraditional’ uses are gaming, listening to radio, multimedia messaging and Internet access.

Staying in touch with their social network is their prime concern.

Ubiquitous availability is challenged primarily by cost, imperfect coverage, “Bad reception defeats the point of a mobile”, short battery life, and losing the phone.

70 percent of UK participants have payas-you-go (non-contract) phones. Many chose their provider according to their social circle’s preferences in order to control and minimise costs.

Changes in life style

Mobile Users’ Needs and Expectations of Future Multimedia Services [pdf]

Challenges in delivering multimedia content in mobile environments 1999 [pdf]

3 Es of social media

  • Educate
  • Engage
  • Entertain

Social Media Marketing

The act of using social influencers, social media platforms and online communities for marketing, publication relations and customer.

social tool

 

【paper】Rendering Parametric Surfaces in Pen and Ink

rendering parametric free-form surfaces in pen and ink:

This paper extends the pen and ink illustration algorithms from Winkenbach et al. 1994 to parametric surfaces. The main difference between this approach and the previous is that the texture and tone cannot be defined on a planar map, but instead must allow for curved surfaces. Controlled density hatching is introduced to maintain tone levels across parameteric surfaces by adjusting the thickness of the strokes used to create the tone and texture. In addition, methods for creating outline strokes and shadows are modified to be used with free-form surfaces.

Art and Cultural Heritages
Content-based search of art image database (1995-1999, 2002- )

reference

Georges Winkenbach and David H. Salesin. “Rendering Parametric Surfaces in Pen and Ink”. In In Proceedings of ACM SIGGRAPH 1996,ACM Press / ACM SIGGRAPH, pp. pp. 469–476, 1996. [html]

python function definition

1.函数参数是如何定义的 

python 函数参数的定义功能很强大,尤其是它的位置参数和关键字参数的定义,这在其他的语言里是没有的。

在python中函数参数的定义主要有四种方式
1.F(arg1,arg2,…)

这是最常见的定义方式,一个函数可以定义任意个参数,每个参数间用逗号分割,在调用的的时候也必须在函数名后的小括号里提供个数相等顺序相同的值(实际参数),即形参和实参的个数必须一致,而且必须一一对应。例如:
def a(x,y):
print x,y
调用该函数,a(1,2)则x取1,y取2,形参与实参相对应,如果a(1)或者a(1,2,3)则会报错。

2.F(arg1,arg2=value2,…)
这种方式提供了参数默认值
def a(x,y=3):
print x,y
调用该函数,a(1,2)同样还是x取1,y取2,但是如果a(1),则不会报错了,这个时候x还是1,y则为默认的3。上面这俩种方式,还可以更换参数位置,比如a(y=8,x=3)用这种形式也是可以的。关键字传递就是根据每个参数的名字传递值,而不用遵守固定的位置。

3.F(*arg1)
不确定有多少个参数,以一个*加上形参名的方式来表示这个函数的实参个数不定,可能为0个也可能为n个。注意一点是,不管有多少个,在函数内部都被存放在以形参名为标识符的tuple中:

def funcD(a, b, *c):
print a
print b
print “length of c is: %d ” % len(c)
print c
调用funcD(1, 2, 3, 4, 5, 6)结果是
1
2
length of c is: 4
(3, 4, 5, 6)

4.F(**arg1)
形参名前加俩个*表示,所有正常形参之外的其他的关键字参数都将被放置在以形式名为标识符的dictionary中,使用双颗星的时候调用函数的方法则需要采用arg1=value1,arg2=value2这样的形式。

def funcF(a, **b):
print a
for x in b:
print x + “: ” + str(b[x])
调用funcF(100, c=’你好’, b=200),执行结果
100
c: 你好
b: 200

关键字参数(keyword argument)调用函数允许调用函数的时候打乱参数传递顺序。

2.在调用函数的过程中参数是如何被解析

上面这四种方法优先级依次降低,先1,后2,再3,最后4

先把方式1中的arg解析,然后解析方式2中的arg=value,再解析方式3,即是把多出来的arg这种形式的实参组成个tuple传进去,最后把剩下的key=value这种形式的实参组成一个dictionary传给带俩个星号的形参,也就方式4

>>> def test(x,y=1,*a,**b):
print x,y,a,b

>>> test(1)
1 1 () {}
>>> test(1,2)
1 2 () {}
>>> test(1,2,3)
1 2 (3,) {}
>>> test(1,2,3,4)
1 2 (3, 4) {}
>>> test(x=1,y=2)
1 2 () {}
>>> test(1,a=2)
1 1 () {‘a’: 2}
>>> test(1,2,3,a=4)
1 2 (3,) {‘a’: 4}
>>> test(1,2,3,y=4)

Traceback (most recent call last):
File “<pyshell#52>”, line 1, in -toplevel-
test(1,2,3,y=4)
TypeError: test() got multiple values for keyword argument ‘y’

3.函数返回值 

python 函数返回值有两种形式: 1 返回一个值。 2 返回多个值。 现看看返回一个值的吧。

def firstvalue(a,b):
c = a + b
return c

print firstvalue(1,2)结果:3

再看看返回多个值的: python可以返回多个值:

def secondvalue(a,b):
c = a + b
return (a,b,c)

x,y,z = secondvalue(1,2)
print ‘x:’,x,’y:’,y,’z:’,z

via

[zz] 怎样做研究生——如何选题和选导师,如何考虑研究中的情感因素

一、论文

做论文将占据研究生生活的大部分时间,主要是去做研究,包括选题,这比实际的写作耗时更多。硕士论文的目的是为做博士论文练兵。博士水平的研究如果没有准备好的话,是很难进行的。硕士论文最本质的要求是展示自己的掌握程度:你已经完全理解了本领域最新进展,并具备相应的操作水平。并不需要你对本领域的最新知识有所拓展,也不要求发表你的论文。但我们实验室的论文总是比较大气的,因此很多硕士论文实际上都对本领域的发展做出了显著的贡献,大约有一半都出版了,这并不一定是好事情,很多人精力都集中于硕士的工作,所以我们也有这样的名声:硕士论文的质量往往比博士论文高。这有悖于硕士工作本来是为博士研究做准备的原有目的。
论文的另外一个因素是所做研究要对领域有所贡献,至少需要两年,这使得研究生学习时间之长令人难以忍受。现在或许你感受不到匆忙,但当你已经在实验室呆了七年后,你肯定迫不及待地想逃出去。硕士从入学到毕业平均时间是两年半,如果某个硕士生的题目过于庞大,可将之分解,一部分来做硕士论文,另一部分给博士生作博士论文。想要了解硕士论文研究是什么样的,读几本最新的硕士论文。记住比较好的论文是那些出版的或者成为技术报告的,因为这标志着该论文被认为是扩展了领域的最新知识——换句话说,他们的论文远远超出了硕士论文的水平。还要读一些通过的但是没有出版的论文。博士论文必须对最新知识有所拓展,博士论文的研究必须具备可出版的质量。
选题是论文工作中最重要最困难的部分:好的论文题目不仅能够表达个人观点,而且可与同行交流。选择题目必须是自己愿意倾注热情的,其远景是你愿意作为一个科学家的理由,是你最为关注的目标。或许你想造一台可与之交谈的计算机,或许你想把人类从计算机的愚蠢使用中拯救出来,或许你想展示万物都是统一的,或许你想在太空发现新生命。远景观点总是比较大的,你的论文并不能实现你的远景,但是可以朝着那个方向努力。
做论文时,最困难的就是如何将问题缩减至可解决的水平,同时规模又足以做一篇论文。题目太大太虚了,你会发现需要不断的缩小题目的范围。选题是一个渐进的过程,会持续到你宣布论文已经完成那一刻为止。实际上,解决问题通常比精确地描述问题要容易得多。如果你的目标是一个五十年的工程,那么合理的十年工程是什么,一年的呢?如果目标的结构庞大,那么最核心的部件是什么?如何最大程度的了解核心部件?一个重要的因素是你可以忍受多大程度的风险。在最终的成功和风险之间需要权衡。
好的论文选题要有一个中心部分,你确信肯定可以完成,并且你和你的导师都同意这已经满足毕业要求了。除此之外,论文中还有多种扩展,有失败的可能,但如果成功了,会增加论文的精彩程度。虽然不是每一个论文选题都符合这个模式,但值得一试。有些人觉得同时在多个项目中工作可以在选题的时候选择可以完成的那个,这确实降低了风险。另外一些人则愿意在做任何工作之前,选一个单独的题目。
可能你只对某个领域感兴趣,这样你的选题范围就狭窄得多。有时候,你会发现系里的老师没有一个人能够指导你选择的领域,可能还会发现好像那个领域没什么很自然的选题,反而对别的领域有好想法。硕士选题比博士选题更难,因为硕士论文必须在你所知不多没有足够自信时就完成。博士选题需要考虑的一个因素是是否继续硕士阶段所研究的领域,可能拓展或者作为基础,或者干脆转到另外一个领域。待在同一个领域事情就简单了,可能只需要一到两年就毕业了,特别是如果在硕士阶段的工作中已经发现了适合做博士论文的题目。不足之处在于容易定型,改换领域则能增加知识的宽度。
有的论文题目很新奇,有的则很普通。前者开创了新领域,探索了以前未曾研究过的现象,或者为很难描述的问题提供了有效的解决方法;后者则完美地解决了定义良好的问题。两种论文都是有价值的,选择哪一种论文,取决于个人风格。
无论选什么样的题目,必须是前人未曾做过的。即使是同时有人做的工作,也不好。有很多东西可作,根本无需竞争。还有一种常见的情况,读了别人的论文后感觉很惊慌,好像它已经把你的问题解决了。这通常发生在确定论文题目过程中。实际上往往只是表面类似,因此将论文送给某个了解你的工作的高人看看,看他怎么说。另外,每个论文的“将来的工作”部分,是很好的论文题目来源。
选好题后,你必须能够回答下列问题:论文的论点是什么?你想说明什么?你必须分别有一句、一段、五分钟的答案。如果你不知道自己在干什么,别人也不会严肃对待你的选题,更糟糕的是,你会陷在选题——再选题的圈子里而不能自拔。
开始作论文研究后,一定要能够用简单的语言解释每一部分的理论和实现是如何为目标服务的。记住,一旦选好了题目,你必须与导师就论文完成的标准达成清晰的一致。如果你和他对论文具有不同的期望,最后你肯定死得很惨。必须定义好“完成”的测试标准,像一系列的能够证明你的理论和程序的例子,这是必须做的,即是你的导师并不这么要求。如果环境发生了根本的变化,测试也要随之改变。用实例检验是最简单的测试方式。做论文的过程中,有很多浪费时间的方式,要避免下列活动(除非确实跟论文相关):语言表达的设计;用户接口或者图形接口上过分讲究;发明新的形式化方法;过分优化代码;创建工具;官僚作风。任何与你的论文不是很相关的工作要尽量减少。一种众所周知的“论文逃避”现象,就是你突然发现改正某个操作系统的BUG是非常吸引人也很重要的工作,此时你总是自觉不自觉的偏离了论文的工作。要记住自己应该做些什么(本文对于部分作者来说就属于论文逃避现象)。
二、导师
导师应该有两种类型,教学导师和论文导师,由于一些客观原因,我们科里的导师身兼两职,既是教学导师又是论文导师。
教学导师的作用是作为系方代表,告诉你对你的正式要求是什么,如果你的进度慢了敦促你,批准你的课程计划等。如果一切顺利的话,你每年只需要见教学导师两次,在注册日那天。从另一方面讲,如果你遇到了困难,教学导师替你向系里反映或者提供指导。论文导师是监督你研究的人,选择论文导师是你读研期间最重要的选择,比选题都重要得多。有很多领域的技术方面或者研究过程中的非正式知识,只能从导师那里学到,在任何教科书上都找不到。导师与研究生的关系是非常个性化的,你的个人特点必须与导师的配合得很好,这样你们才能合作成功。不同的导师具有不同的风格。
下面是一些需要值得考虑的因素(对四医大而言,基本上在录取时就确定了导师,下面亦可作为与导师交流及课题选择时的参考):
你需要多大程度的指导?有些导师会给你一个定义良好的适合做论文的问题,对解决方法进行解释,并告诉你如何开展工作。如果你陷在某个地方了,他们会告诉你如何开展下去。有些导师则属于甩手型,他们可能对你的选题毫无帮助,但是一旦你选好题目,他们对于引导你的思路具有非常大的作用。你需要考虑清楚自己适合独立工作还是需要指导。
你需要多大程度的联系?有的导师要求每周与你见面,听取你工作进展的汇报。他们会告诉你应该读的论文,并给你实际的练习和项目做。而有些导师每学期与你的谈话不会超过两次。
你能承受的压力有多大?有些导师施加的压力是很大的。
听取导师意见的认真程度如何?大多数导师会相当正式地建议你的论文题目。有些导师是值得信赖的,他们给出的建议,如果按照执行,几乎肯定会做出一篇可接受的论文,如果不是令人兴奋的论文的话。有些导师则一下子抛出很多思路,大部分是不切实际的,但是有一些,或许会导致重大突破。如果选了这样的一位导师,你首先得把自己当作一个过滤器。
导师提供了什么类型的研究组?有些教授会创造环境,把所有的学生聚集在一起,即使他们做的不是同一个项目。很多教授每周或者每两周与自己的学生们会面。这对你有用么?你能与教授的学生和睦相处么?有些学生发现他们更能与其他教研组的学生建立良好的工作关系。
你想参与大的项目么?有些教授将大系统分解,每个学生负责一部分。这给了你与一组人讨论问题的机会。有些论文项目包含了多个研究领域,需要你与两个以上的教授建立密切的工作关系。虽然你正式的论文导师只有一位,但是有时候这并不反映实际情况。
导师愿意指导其研究领域之外的论文题目么?你是否能与导师一起工作,比你做什么本身更重要。推理方面的教员指导过视觉方面的论文。但是有些教员只愿意指导自己研究兴趣领域内的论文,这对于那些欲获得终身职位的年轻教员来说尤其如此。
导师愿意并且能够在会议上推荐你的工作吗?这是导师工作的一部分,对你将来工作意义重大。上述这些因素,不同学校的情况很不相同。
研究生研一结束或研二学年开始阶段,必须找导师对你的论文进行指导,下面是一些诀窍。查阅实验室的研究总结,其中有一页左右的篇幅描述了每个教师以及很多研究生目前在做什么。如果你对某些教师的研究工作感兴趣,查阅其最近的论文。在第一学期,与尽可能多的教师交谈,去感受他们喜欢做什么,他们的研究和指导风格是什么。与预期导师的研究生交谈,要保证与导师的多个学生交流,因为每位导师在与不同的学生交流时有不同的工作方式和交流效果,不能被一个学生的看法所左右。很多教师所在研究组的会议对新同学都是公开的,这是非常好的了解导师工作方式的途径。不要由于交流不好,浪费时间在自己并不想做的项目上。不要完全依赖你的导师,要建立自己的网络,找一些能定期评审你的工作的人是很重要的,因为研究时很容易走火入魔。网络中的人可以包括自己实验室或者外单位的研究生和老师。实验室中有些同学只是名义上由导师指导,这对于那些独立性很强的人来说很好。除非你确保自己没有导师也行,且有牢靠的支持网络,否则就不要这么干。
三、情感因素
研究是艰苦的工作,很容易对之失去兴趣。一个令人尴尬的事实是在本实验室读博的学生只有很少比例最后获得学位。有些人离开是因为可以在产业界赚到更多的钱,或者由于个人的原因;最主要的原因则是由于论文。本节的目标是解释这种情况发生的原因,并给出一些有益的建议。
所有的研究都包含风险。如果你的项目不可能失败,那是开发,不是研究。面对项目失败时是多么艰难啊,很容易将你负责的项目失败解释为你自己的失败,虽然,这实际上也证明了你有勇气向困难挑战。在人工智能领域很少有人总是一直成功,一年年地出论文。实际上,失败是经常的。你会发现他们经常是同时做几个项目,只有一些是成功的。最终成功的项目也许反复失败过多次,经历过很多由于方法错误的失败之后,才取得最终的成功。在你以后的工作生涯中,会经历很多失败。但是每一个失败的项目都代表了你的工作,很多思想,思考方式,甚至编写的代码,在若干年后你发现可用于另外一个完全不同的项目。这种效果只有在你积累了相当程度的失败之后才会显现出来。因此要有最初的失败后才会成功的信念研究所花费的实际时间往往比计划的要多得多,一个小技巧是给每个子任务分配三倍于预期的时间(有些人加了一句:“……,即使考虑了这条原则”)。
成功的关键在于使得研究成为你日常生活的一部分。很多突破和灵感都发生在你散步时。如果无时无刻地都潜意识的思考研究,就会发现思如泉涌。成功的研究者,坚持的作用一般大于天资。“尝试”也是很重要的,就是区分浅薄和重要思路的能力。你会发现自己成功的比例是很随机的。有时候,一个星期就做完了以前需要三个月才能完成的工作,这是令人欣喜的,使得你更愿意在本领域工作下去。其他一些时候,你完全陷在那里,感觉什么也做不了,这种情况很难处理。你会觉得自己永远不会做出任何有价值的东西了,或者觉得自己不再具备研究者的素质了。这些感觉几乎肯定是错误的,你需要的是暂停一下,对糟糕的结果保持高度的容忍。
通过定期设置中短期的目标,例如每周的或者每月的,你有很多工作要做。增加达到这些目标的可能性有两种方法,你可以把目标记在笔记本中,并告诉另外一个人。你可以与某个朋友商定交换每周的目标并看谁最终实现了自己的目标,或者告诉你的导师。有时你会完全陷在那里,类似于写作过程的思路阻塞,这有很多可能的原因,却并无一定的解决方法。
如果范围过于宽泛,可尝试去解决流程中的子问题。
有时候对你研究能力的怀疑会消磨掉你所有的热情而使得你一事无成。要牢记研究能力是学习而得的技能,而不是天生的。
如果发现自己陷入严重的困境,一个多星期都毫无进展,尝试每天只工作一小时。几天后,你可能就会发现一切又回到了正轨。
害怕失败会使得研究工作更加困难。如果发现自己无法完成工作,问问自己是否是由于在逃避用实验检验自己的思路。发现自己最近几个月的工作完全是白费的这种可能,会阻止你进一步开展工作。没有办法避免这种情况,只要认识到失败和浪费也是研究过程的一部分。
看看Alan Lakien的书《How to Get Control of Your Time and Your Life》,其中包含很多能使你进入充满创造力的状态的无价方法。
在数学中,如果你证明了某个定理,你就确实做了某些事情;如果该定理别人都证不出来,那么你的工作是令人兴奋的。但不同的实践者、子领域和学校会强调不同的标准。这样的一个后果就是你不可能令所有的人都满意。另外一个后果就是你无法确定自己是否取得了进展,这会让你觉得很不安全。对你工作的评价从“我所见过最伟大的”到“空虚,多余,不明所以”不一而足,这都是很正常的,根据别人的反馈修订自己的工作。有几种方法有助于克服研究过程中的不安全感。被承认的感觉:包括毕业论文的接受,发表论文等。更重要的是,与尽可能多的人交流你的思路,并听取反馈。首先,他们能贡献有用的思路;其次,肯定有一些人会喜欢你的工作,这会使你感觉不错。由于评价进展的标准是如此不确定,如果不与其他的研究者充分的交流,很容易盲目。特别当你感觉不太好时,应该就你的工作进行交流。此时,很容易看不到自己的贡献,总是想:“如果我能做,肯定是微不足道的。我的所有思想都太明显了”。实际上,当你回头看时,这些虽然对你是很明显的,对别人却并不一定是明显的。将你的工作解释给很多门外汉听,你会发现对你来说平淡无奇的东西原来那么难!获得反馈和支持是非常重要的。一项对诺贝尔获奖者进行的关于怀疑自己问题(在你研究的过程中,你一直觉得自己是在做震惊世界的工作吗?)的调查表明:获奖者们一致回答他们经常怀疑自己工作的价值和正确性,都经历过觉得自己的工作是无关的、太明显了或者是错误的时期。任何科学过程中常见和重要的部分就是经常严格的评价,很多时候不能确定工作的价值也是科学过程不可避免的一部分。有些研究者发现与别人协作比单打独斗工作效果更好。
很多来到实验室的学生都是以前所在学校最厉害的人。到了这里后,会发现很多更聪明的人,这对于很多一年级学生的自尊形成了打击。但周围都是聪明人也有一个好处:在你把自己不怎么样的(但自己又没有觉察到)想法发表之前就被其他人给打倒在地了。更现实的讲,现实世界中可没有这么多聪明人,因此到外面找一份顾问的工作有利于保持心理平衡。首先,有人会为你的才能付费,这说明你确实有些东西。其次,你发现他们确实太需要你的帮助了,工作带来了满足感。反之,实验室的每一个学生都是从四百多个申请者挑选出来的,因此我们很多学生都很自大,很容易认为只有我才能解决这个问题。这并没什么错,而且有助于推进领域的发展。潜在的问题是你会发现所有的问题都比你想象的要复杂得多,研究花的时间比原先计划的多得多,完全依靠自己还做不了。这些都使得我们中的很多人陷入了严重的自信危机。你必须面对一个事实:你所做的只能对某个子领域的一小部分有所贡献,你的论文也不可能解决一个重大的问题。这需要激烈的自我重新评价,充满了痛苦,有时候需要一年左右的时间才能完成。但这一切都是值得的,不自视过高有助于以一种游戏的精神去作研究。人们能够忍受研究的痛苦至少有两个情感原因。一个是驱动:对问题的热情。你做该研究是因为离开它就没法活了,很多伟大的工作都是这样做出来的,虽然这样也有油尽灯枯的可能。另外一个原因是好的研究是充满乐趣的。在大部分时间里,研究是令人痛苦的,但是如果问题恰好适合你,你可以玩一样的解决它,享受整个过程。二者并非不可兼容,但需要有一个权衡。要想了解研究是怎么样的,遭到怀疑的时候应该如何安慰自己,读一些当代人的自传会有些作用。Gregory Bateson的 Advice to a Young Scientist,Freeman Dyson的Disturbing the Universe, Richard Feynmann的Surely You Are Joking, Feynmann和George Hardy的A Mathematician’s Apology,以及Jim Watson的The Double Helix。
当你完成了一个项目——例如论文——一两个月后,你可能会觉得这一切是那么不值。这种后冲效果是由于长时间被压抑在该问题上,而且觉得本可以做得更好。总是这样的,别太认真。等再过了一两年,回头看看,你会觉得:嘿,真棒!多棒的工作!
via http://mvom.hfut.edu.cn/display.php?id=162

[paper]Fast Multiresolution Image Querying

User may paint on a “canvas” of any aspect ratio. However, the painted query is internally rescaled to a square aspect ratio and searched against a database in which all images have been similarly rescaled as a preprocess.

how a user-specified aspect ratio might also be used to improve the match?

To evaluate our image querying algorithm, we collected three types of query data:

  • The first set, called “scanned queries,” were obtained by printing out small 1/2×1/2  thumbnails of our database images. 270: 100 were reserved for evaluating our metric, and the other 170 were used as a training set.
  • The second set, called “painted queries,” were obtained by asking 20 subjects, most of whom were first-time users of the system, to paint complete image queries, in the non-interactive mode, while looking at thumbnail-sized versions of the images they were attempting to retrieve. 270
  • The third set, called “memory queries,” without being able to see the image directly. 100 queries only for evaluation

To see if painting from memory would affect retrieval time: 3 subjects

  • Each subject was then asked to paint the 10 images from the first set while looking at a thumbnail of the image, and the 10 images from the second set from memory
  • median query time increased from 18 seconds when the subjects were looking at the thumbnails, to 22 seconds when the queries were painted from memory.

Users will typically be able to sketch all the information they know about an image in a minute or less, whether they are looking at a thumbnail or painting from memory.

  1. If the query fails to bring up the intended target within a minute or so, users will typically try adding some random details, which sometimes help in bringing up the image.
  2. If this tactic fails, users will simply give up and, in a real system, would presumably fall back on some other method of searching for the image.

benefits of painting queries interactively:

  1. the time to retrieve an image is generally reduced because the user simply paints until the target image appears, rather than painting until the query image seems finished.
  2. the interactive mode subtly helps “train” the user to find images more efficiently, because the application is always providing feedback about the relative effectiveness of an unfinished query while it is being painted.

Multiresolution Query by Image Content

The key to the algorithm is the establishment of an effective and efficient metric capable of computing the distance between a query image Q and a potential target image T. The chosen metric use the YIQ color space and the Haar wavelet.

figure1.gif (82382 bytes)

Wavelet decomposition:

  • few coefficients provides a good approximation of the original image retaining information from existing edges;
  • presents relative invariance to resolution changes;
  • it is fast to compute, running in linear time in size of the image;
  • spatial localization of the frequencies.

Compute Haar wavelet transform For each image, truncating and quantizing its coeffecients. Those remaining coeffecients represent the image signature.

figure3.gif (19639 bytes)

A painting its truncated and quantized wavelet decomposition with 2000 coefficients
(Y color channel)
the actual decomposition used with 60 coefficients
(Y color channel)

Improvement:

To use a low-resolution database, and also use a low-resolution version of the image provided for querying. This speeds up the process substantially and gives essentially the same results since the continuous wavelet transform is invariant under change of scale and almost all of the largest m coefficients are located in the low resolution.

We implemented an estimated perceptual of approximation between the query image and the images in the data base.

  • We also tried to use another Haar decomposition, which is faster than the one used by Salesin et al.. The results were good, in spite of using the same weights of the Haar initially used.
  • shark.gif (360661 bytes)

Stackoverflow:I implemented a very reliable algorithm for this called Fast Multiresolution Image Querying. My (ancient, unmaintained) code for that is here.

What Fast Multiresolution Image Querying does is:

  • split the image into 3 pieces based on the YIQ colorspace (better for matching differences than RGB).
  • Then the image is essentially compressed using a wavelet algorithm until only the most prominent features from each colorspace are available.
  • These points are stored in a data structure.
  • Query images go through the same process, and the prominent features in the query image are matched against those in the stored database.
  • The more matches, the more likely the images are similar.

The algorithm is often used for “query by sketch” functionality. My software only allowed entering query images via URL, so there was no user interface. However, I found it worked exceptionally well for matching thumbnails to the large version of that image.

Much more impressive than my software is retrievr which lets you try out the FMIQ algorithm using Flickr images as the source. Very cool! Try it out via sketch or using a source image, and you can see how well it works.

http://cnx.org/content/m11694/latest/?collection=col10223/latest

Mona Lisa (monalisa.jpg)

person has a coarse-scale idea of what the Mona Lisa, for instance, looks like. This information should be fairly useful for finding an actual image of the Mona Lisa, but given current techniques, searches for visual data break down as effective strategies when the database size increases to even a small fraction of the number of images on the World Wide Web.

Our algorithm should also be well suited to matching coarse-scale versions of images to high detail versions of the same image. Users should be able to sketch an image in a simple drawing application where a lot of detail is not easy to add to the query image. They should also be able to enter images that have been digitized by the use of a scanner, which we assume introduces blurriness and additional noise such as scratches, dust, etc, to the extent that they would find it highly useful to search for a higher-resolution version of the image online.

Ideally, we would also like our algorithm to be able to handle affine transformations, such as translation, rotation, and scaling. It is unreasonable to expect a user to be able to draw parts of an image in exactly the same region that they appear in the original image. While these three transformations are all important components of an image querying system, we made the decision to focus on translation because it seems like the most likely type of error that a user would make.

The primary drawback of FMIQ is that the approach is ineffective for detecting shifts of an image since the separable discrete wavelet basis is not shift-invariant. Therefore, we propose the use of the complex discrete wavelet basis which possesses a high degree of shift-invariance in its magnitude. When coupled appropriately with the two-dimensional Discrete Fourier Transform, the two-dimensional Complex Discrete Wavelet Transform allows us to match shifted versions of an image with a significantly higher degree of certainty than does the approach of Jacobs, et al.

The signatures are computed as follows:

  1. Compute the discrete wavelet transform of the image.
  2. Set all but the highest magnitude wavelet coefficients to 0.
  3. Of the remaining coefficients, quantize the positive coefficients to +1 and the negative ones to –1.
  4. These +1’s and –1’s correspond to the feature points in an image, and basically characterize the image structure. Jacobs et al. concluded, after some experimentation, that on their database, considering the top 60 magnitude coefficients worked well for scanned images, while the top 40 coefficients gave best results for hand-drawn images.
  5. The signatures in our implementation were compared using the generic L1 norm of the difference between signature matrices. Jacobs et al. use the non-intuitive “Lq” norm, which somehow weights the coefficients corresponding to different scales differently. This idea definitely carries some merit, but Jacobs et al. do not provide a very good explanation of this scheme, and we don’t believe that it will improve the performance of their querying algorithm significantly.

【ACTIVE BASIS】the model learns to sketch

the main introduction is maintained by Ying Nian Wu,

  • How to represent a deformable template? 

The answer is no much beyond wavelet representation, just add some perturbations to the wavelet elements.
The perturbations and the coefficients of the wavelet elements are the hidden variables that seek to explain each individual training image.

Active basis.

Each Gabor wavelet element is illustrated by a thin ellipsoid at a certain location and orientation.

The upper half shows the perturbation of one basis element. By shifting its location or orientation or both within a limited range, the basis element (illustrated by a black ellipsoid) can change to other Gabor wavelet elements (illustrated by the blue ellipsoids). Because of the perturbations of the basis elements, the active basis represents a deformable template.

The model is generative and seeks to explain the images.

  • How to learn a deformable template from a set of training images?

The answer is no much beyond matching pursuit, just do it simultaneously on all the training images.
The intuitive concepts of “edges” and “sketch” emerge from this process.

    • learning by shared sketch algorithm

REFERENCE

  • Learning Active Basis Model for Object Detection and Recognition [pdf]
  • Wavelet, Active Basis, and Shape Script — A Tour in the Sparse Land 2010 [pdf]
  • Learning Active Basis Models by EM-Type Algorithms [pdf]

 

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web