2010. 5. 9. 21:10 Shopping
'Hyojunguy'에 해당되는 글 120건
- 2010.05.09 프로젝트S 벌써 5월달
- 2010.05.09 내 티스토리 다시 시작!
- 2010.04.05 체함
- 2010.03.05 Network programming with the Twisted framework, Part 1
- 2010.03.01 Object Recognition
- 2010.02.04 아이폰에서 글쓰기 테스트
- 2010.01.31 google goggles
- 2010.01.31 iPad: Multimedia Storytelling Designer
2010. 5. 9. 20:57 Aphorism/Diary
내 티스토리 다시 시작!
2010. 4. 5. 07:09 Aphorism/Diary
체함
경민과 술한잔 하고 왔다 그리고 일요일 하루 종일 배아파 이리 뒹굴고 저리 뒹굴고 ,,, 혼자 사는 서라움이란 ... 눈꺼풀 떼어내고 맑은 눈으로 세상을 다시 바라보자 ~ 상처 투성인 몸과 마음 ~ 누가 자처한 길인가? 지금 필요한 것은 형식적으로 내 자신을 돌아보는 시간을 갖는것 배아픈 건 언제 좋아질런지 ㅜㅜ
iPhone 에서 작성된 글입니다.
'Aphorism > Diary' 카테고리의 다른 글
의욕, 시간 부족 (0) | 2010.05.21 |
---|---|
내 티스토리 다시 시작! (0) | 2010.05.09 |
아이폰에서 글쓰기 테스트 (0) | 2010.02.04 |
Oh! 소녀시대 (0) | 2010.01.31 |
최근 사진들.. (0) | 2010.01.30 |
2010. 3. 5. 17:16 Programming/Python
Network programming with the Twisted framework, Part 1
Summary: Twisted is an increasingly popular pure-Python framework for programming network services and applications. While there are a large number of loosely coupled modular components within Twisted, a central concept to the framework is the idea of non-blocking asynchronous servers. In this article, David introduces you to this style of programming -- a novel one for developers accustomed to threading or forking servers, but one capable of great efficiency under heavy loads.
Sorting through the Twisted framework is reminiscent of the old story about blind men and elephants. Twisted has many capabilities, and it takes a bit of a paradigm switch to get a good sense of why they are all there. In fact, as I write this first installment, I am probably only halfway toward getting my mind fully around Twisted. We can work through it together.
One of the strengths of recent versions of Python is that they come with "batteries included" -- that is, the standard distribution includes modules to do just about everything you want to accomplish in most programming tasks. For the most part, when you want a third-party Python module or package, it is to accomplish some specialized and unusual task. Twisted is one of few exceptions to the pattern described; developed by Twisted Matrix Laboratories, it is a well-designed and general-purpose collection of modules for performing all manner of network programming tasks, in ways not easily facilitated by Python's standard library.
It is not quite true that Python's standard library lacks
support for asynchronous, non-blocking network applications.
The module asyncore
provides basic
support for switching
among I/O channels within a single thread. But Twisted
takes the style to a higher level and provides a huge
collection of pre-built and reusable protocols, interfaces, and
components.
The documentation that accompanies Twisted is quite
extensive, but hard to get a handle on. Let's start with a
simple server, and build on that. In a recent
developerWorks tip (see Resources for a link),
I demonstrated an XML-based "Weblog server"
that presents to a client a stream of records about the latest
hits to a Web server. The XML aspect is not important here,
but the use of SocketServer
and its
ThreadingTCPServer
class
is useful as a baseline. This pre-Twisted server consists of:
Listing 1. SocketServer-weblog.py
from SocketServer import BaseRequestHandler, ThreadingTCPServer |
Other than that overhead of its per-client thread creation, a
notable feature of the SocketServer
-based server is its use of
a blocking call to time.sleep()
within its
handler. For Twisted's non-blocking select()
loop,
such a block is not permissible.
A first non-blocking approach pushes any artificial delays onto the client, and lets the client specifically request each new batch of Weblog records (and also sends a message to indicate their absence, rather than send nothing). This Twisted server looks like:
Listing 2. twisted-weblog-1.py
from twisted.internet import reactor |
Readers should refer to my prior tip for details on the client application. But the following change should be noted. The main client loop adds two lines:
Listing 3. Enhanced (blocking) client loop
while 1: |
A Twisted server consists of several modular elements.
At a bytestream level, a server implements a protocol, often by
inheriting from twisted.internet.protocol.Protocol
or from
some previously specialized child of it. For example, provided
subclasses (in twisted.protocols
) include
dns
, ftp
,
gnutella
, http
,
nntp
, shoutcast
,
and many others.
Basically, a protocol should know how to handle making and
losing connections, and receiving and sending data within a
connection. These responsibilities are not much different than
in a SocketServer
-based server,
except in being slightly
more modular in defining methods for each element.
The next level of a Twisted server is a factory. In our
twisted-weblog-1.py
example, the factory
really does nothing
besides store a protocol. In a more sophisticated server,
however, a factory is a good place to perform initialization
and finalization related to a protocol server. And probably of
greatest interest, a factory can be persisted within
applications (we will see those soon).
Neither a protocol nor a factory knows anything about the
network the server runs on. Instead, a reactor is a class
that actually listens on a network (utilizing a factory
instance for its protocol). Basically, a reactor is just a
loop that listens on a given port and network interface (which
one is chosen by calling a method like .listenTCP()
,
.listenSSL()
, or .listenUDP()
). The thing to understand is
that the basic reactor in Twisted, SelectReactor
, runs
in a single thread; each connection is checked for new data,
and the data is delivered to the relevant protocol object. An
upshot is that a protocol object is really not allowed to
block, or even just take too long to complete (protocols must
be programmed appropriately).
Let's try to enhance the Twisted Weblog server so that it
follows the pattern of SocketServer-weblog.py
in feeding new
records to clients without the need for repeated requests from
those clients. The problem here is inserting a time.sleep()
call into a method of WebLog(Protocol)
causes it to block,
and so is not allowed. While we are at it, notice that the
prior servers probably do the wrong thing in that they feed
each new batch of records only to one client. Presumably, if
you want to allow multiple clients to monitor a Weblog, you
want them all to receive ongoing updates.
The way you delay actions in Twisted without blocking is
to add callbacks to a reactor, using the .callLater()
method.
A callback added this way is added to the queue of events to
service, but it will not actually be processed until after a
specified delay. Putting both changes together, an enhanced
Weblog server looks like:
Listing 4. twisted-weblog-1.py
from twisted.internet import reactor |
In this case, we define a custom factory and move some of the
initialization from the _main_
block to the
factory. Notice
also that the clients for this server need not (and should not)
sleep or send new requests -- in fact, I use the exact client
application I discussed in the XML tip (see Resources).
The factory and the protocol use the same technique in their
custom methods .updatedRecords()
and .newHits()
,
respectively. That is, if a method wants to run periodically, its
last line can schedule it to run again at a specified delay. On
its face, this pattern looks a lot like recursion -- but it is not
(moreover, the repeat scheduling need not occur on the
last line; it just makes sense there). The method .newHits()
,
for example, simply lets the controlling reactor loop know that
it wants to be called in another 5 seconds, but the method itself
terminates. There is no requirement that a method schedule only
itself -- it can schedule whatever it wants to occur, and
functions quite apart from factory or protocol methods can be
added to a reactor loop, if you wish.
Besides reactor.callLater()
scheduling,
Twisted contains a general class twisted.internet.defer.Deferred
. In
essence, deferreds are a generalization of scheduled callbacks,
but allow techniques such as chaining dependent callbacks and
handling error conditions in these chains. The idea behind a
Deferred
object is that when you call a
method, rather than
wait for its results (which may take a while to arrive), the
method can immediately return a Deferred
object that the
reactor/scheduler can call again later, when results are expected
to be available.
I have not really played with Deferred
objects yet, but it
feels like getting them right will be slightly tricky. If you
need to wait on a blocking action -- say, the results from a
remote database query -- it is not clear exactly how long you
will need to wait for results to be available. Deferred
objects do have a timeout mechanism, but I will have to come
back to that in a later installment. Interested readers should
at least know that the Twisted Matrix developers have attempted
to provide a standard API for wrapping blocking actions. Of
course, the worst case is to fall back to using threads for
blocking actions that really cannot be converted into
asynchronous callbacks.
Another important element to Twisted servers is their easy
support for persistence. A reactor is a loop that monitors and
responds to I/O events. An application is much like an enhanced
reactor that is able to pickle its state for later re-starting.
Moreover, applications can be statefully saved into ".tap" files,
and can be managed and daemonized using the tool twistd
.
Here's a simple example that illustrates the usage (modelled on
the Twisted documentation's OneTimeKey
example). This server
delivers distinct Fibonacci numbers to all interested clients,
without repeating numbers between them -- even if the server is
stopped and started:
Listing 5. fib_server.py
from twisted.internet.app import Application |
You can see that mostly all we have changed is replacing
reactor
with application
throughout. While the class
Application
also has a .run()
method, we use its .save()
method to create a Fibonacci.tap
file.
Running this server is
done as:
Listing 6. Running fib_server.py
% python fib_server.py |
The client that connects to this server should use a
time.sleep()
in its loop if it only wants a
new number
intermittently rather than as fast as possible. Obviously, a more
useful server can provide a more interesting stateful datastream.
[1] http://www.ibm.com/developerworks/linux/library/l-twist1.html
'Programming > Python' 카테고리의 다른 글
BeautifullSoup을 사용한 html 파서 (0) | 2009.10.17 |
---|
2010. 3. 1. 21:26 Paper Reading
Object Recognition
CS395T: Special Topics in Computer Vision, Spring 2010
Object Recognition
Course overview Useful links Syllabus Detailed schedule eGradebook Blackboard
Meets: Wednesdays
3:30-6:30 pm
ACES 3.408
Unique # 54470
Instructor:
Kristen
Grauman
Email:
grauman@cs
Office: CSA
114
TA:
Sudheendra
Vijayanarasimhan
Email:
svnaras@cs
Office: CSA
106
When emailing us, please put CS395 in the subject line.
Announcements:
See the schedule
for
current reading assignments.
Course overview:
Topics: This is a graduate seminar
course in computer vision. We will survey and discuss
current vision papers relating to object recognition, auto-annotation
of images, and scene understanding. The goals of the course will
be to understand current approaches to some important problems, to
actively analyze their strengths and weaknesses, and to identify
interesting open questions and possible directions for future research.
See the syllabus
for an outline of the main
topics we'll be covering.
Requirements: Students will be
responsible for writing paper reviews each week, participating in
discussions, completing one programming assignment, presenting once or
twice in class (depending on enrollment, and possibly done in teams),
and completing a project (done in pairs).
Note that presentations are
due one week before the slot
your presentation is scheduled. This means you will need to read
the papers, prepare experiments, make plans with your partner, create
slides, etc. more than one week before the date you are signed up
for. The idea is to meet and discuss ahead of time, so that we
can iterate as needed the week leading up to your presentation.
More details on the
requirements and grading breakdown are here.
Prereqs: Courses in computer
vision and/or machine learning (378 Computer Vision and/or 391 Machine
Learning, or similar); ability to understand and analyze conference
papers in this area; programming required for experiment presentations
and projects.
Please talk to me if you
are unsure if the course is a good match for your background. I
generally recommend scanning through a few papers on the syllabus to
gauge what kind of background is expected. I don't assume you are
already familiar with every single algorithm/tool/image feature a given
paper mentions, but you should feel comfortable following the key ideas.
Syllabus overview:
- Single-object recognition fundamentals: representation, matching, and classification
- Beyond single objects: recognizing categories in context and learning their properties
- Scalability issues in category learning, detection, and search
- Recognition and "everyday" visual data
(생략)
Other useful links:
- Compiled
list
of
recognition
datasets
- OpenCV (open source computer vision library)
- Weka (Java data mining software)
- Netlab (Matlab toolbox for data analysis techniques, written by Ian Nabney and Christopher Bishop)
- CV Online
- Annotated Computer Vision Bibliography
- Computer vision conferences
- ICCV 2005 / CVPR 2007 / ICCV 2009 Short Course on Recognition
- AAAI 2008 Tutorial on Recognition
- ICML 2008 Tutorial on Recognition
Related courses:
Past semesters at UT:
- CS 395T Spring 2007: Object Recognition
- CS 395T Spring 2008: Visual Recognition and Search
- CS 395T Spring 2009: Visual Recognition and Search
By colleagues elsewhere:
- Object Recognition and Scene Understanding, MIT, Antonio Torralba
- Learning-based Methods in Vision, CMU, Alyosha Efros
- Selected Topics in Vision & Learning, UCSD, Serge Belongie
- Recognition Problems in Computer Vision, SFU, Greg Mori
- High-Level Recognition in Computer Vision, Princeton, Fei-Fei Li
- Computer Vision and the Web, UNC, Svetlana Lazebnik
http://www.cs.utexas.edu/~grauman/courses/spring2010/schedule.html
'Paper Reading' 카테고리의 다른 글
ECIR 2011 Best Paper Awards and Other Highlights (0) | 2011.05.04 |
---|---|
Siggraph 2010 papers (0) | 2010.06.07 |
Conference Paper (1) | 2009.04.28 |
2010. 2. 4. 13:22 Aphorism/Diary
아이폰에서 글쓰기 테스트
iPhone 에서 작성된 글입니다.
'Aphorism > Diary' 카테고리의 다른 글
내 티스토리 다시 시작! (0) | 2010.05.09 |
---|---|
체함 (0) | 2010.04.05 |
Oh! 소녀시대 (0) | 2010.01.31 |
최근 사진들.. (0) | 2010.01.30 |
자신을 믿는 다는 것 (0) | 2009.05.09 |
2010. 1. 31. 16:17 Architecture/Service
google goggles
내 밥 벌이와 관련된 일이라.. 관심을 가질 수 밖에...
http://www.google.com/mobile/goggles/#landmark
A picture is worth a thousand words.
(비전 분야 사람들은 이 말에 항상 감사하며 ...)
구글 모바일 센터에서 한 것임을 알 수 있고.. 아직까지 완벽하지 않다고 한다.
(당연히.. local feature가 부족한 것을 recognition 하려고 하면 안되지..)
잘되는 것
books & DVDs, landmarks, logos, contact info, artwork, businesses, products, barcodes, or text
잘 안되는 것
animals, plants, cars, furniture, or apparel
안드로이드폰에서 돌아간다고 한다. ㅎ (이런; 아이폰 유저로써 버럭;;; ㅋㅋㅋ)
아래는 데모 동영상
구글 고글스는 킬러다. 왜냐하면 내가 쓰고 있는 유사 어플이 아이폰에 얼마나 많이 있는지 한 번 살표보자.
물론 컨텐츠의 문제로 직결되기도 한다. 결국 나중에는 많은 DB를 갖춘 쪽이 승리하겠지만...
바코드 인식
RedLaser, QRooQRoo, 지름도우미, Daum책
내 주변 정보 (argumented reality)
iNeedCoffee, Odiyar Lite, Navigator, Nearest ~, AroundMe
현재는 매우 오류율이 높음.. (구글 지도 쓰니.. 제주도는 꽝!)
바코드를 찍는 것보다 책을 그냥 찍는게 편리하고 쉽다.
기타 수작업으로 하는 많은 것들을 자동으로 사진만 찍어서 해주겠다고 하니 분명 킬러 어플일 수 밖에 없다.
아래 링크는 직접 안드로이드폰에서 고글스 직접 체험기
http://androidhuman.tistory.com/292
또 다른 데모 동영상들....
'Architecture > Service' 카테고리의 다른 글
LOL, Looks very much like real world : followers visualization (0) | 2010.05.11 |
---|---|
BumpTop 3D Multi-Touch Desktop (0) | 2010.05.10 |
Google Chrome Speed Tests 동영상 (0) | 2010.05.10 |
Google Social Search (0) | 2010.05.10 |
iPad: Multimedia Storytelling Designer (0) | 2010.01.31 |
2010. 1. 31. 15:18 Architecture/Service
iPad: Multimedia Storytelling Designer
요즘들어 iPad 때문에 관련 주가가 들쑥날쑥하고 뉴스에서 떠들고 있는거 같다. (벌써 식었지만..)
iPad의 기능적인 측면으로 보았을때는 많이 뒤쳐지기 때문에 별루란 이야기가 대세적이다.
하지만 내 생각으로는 net-book과 비교하기 보다는 새로운 e-book 매개체로써 자리잡을 수 있겠단
생각이들었다. 아래의 동영상을 보면 확실히 완성도 있는 새로운 매개체이다.
광고 싣기도 쉽다. (이 놈의 몹쓸 사랑스런 돈...)
[참고]
[1] http://jpyun56.wordpress.com/2010/01/29/ipad-%EC%8B%9C%EB%8C%80%EC%97%90%EB%8A%94-editor%EA%B0%80-%EC%95%84%EB%8B%88%EB%9D%BC-multimedia-storytelling-design%EA%B0%80-%ED%95%84%EC%9A%94%ED%95%98%EB%8B%A4/
'Architecture > Service' 카테고리의 다른 글
LOL, Looks very much like real world : followers visualization (0) | 2010.05.11 |
---|---|
BumpTop 3D Multi-Touch Desktop (0) | 2010.05.10 |
Google Chrome Speed Tests 동영상 (0) | 2010.05.10 |
Google Social Search (0) | 2010.05.10 |
google goggles (0) | 2010.01.31 |