• Train a face dectector using TensorFlow object detection API.

    About 3 years ago, putting together a face detection camera application for mobile devices was more involving a task. I remember a colleague sitting next to me back then tinkering with OpenCV and dlib to produce a demo with the right trade-off between size, speed and accuracy. As with every engineering problem, there is no one-size-fit-all solution. A on-device face detector may choose to reduce the size of input images to quicken detection, though lower resolution results in lower accuracy. Fast forward to the moment, it has never been as easier to customize your own face dection model thanks to folks at Google who open source their Tensorflow object dection api. Besides, platforms like Colab provide hobbists with free access to ML training-capable machines.

  • Building face landmark detection model using Pytorch

    Having used dlib for face landmark detection task, implementing my own neural network to achieve similar goal can be potentially fun and help the learning process. There is this recently released paper that outlines the approach of using machine learning in setting parameters used in traditional statistical models. The author is nice enough to release his source code, which can be a great starting point. So I forked from there, changed code to remove some bulky dependencies, and sort of re-writing it to better fit my mental model and in the process understand it better.

  • Allocate objects on memory buffer for performance gain

    I wrote about the cost of memory allocation in a recent post. Given a fixed amount of memory needed, reserve a large chunk in one go is cheaper than grabing smaller chunks one at a time. I did not realize that Cpp has the facility to take advantage of that until reading through the code of folly::IOBuf.

  • Echo server with libevent

    Network programming is one area where non-blocking IO can be used to achieve higher performance. A typical server needs to handle a few hundreds to a few thousands connections at a time. With the thread-pool based blocking model, when a new connection is established, a server’s thread serving that connection will trigger kernel system call to read data from socket file descriptor, be blocked until data are available. Thus, to handle say 200 connections concurrently, the sever needs to spawn 200 threads.

  • On taking advices

    Last week at work, I saw a large banner, placed at the lift waiting area, promoting a soon to be published book. On the cover there was a guy similing confidently. He is an economist professor who appeared in the news a few years ago for his controversial lectures. However, this book is not an economic book, but rather a how-to guide to life. I have not read the book. The thing that caught my attention is a piece of advice that is exerpted from it: “Emotion/Feeling is the enemy of success”.

  • The underestimated cost of memory allocation

    In languages like Java and C++, memory allocation is explicit and obvious. Programming with arrays in those languages mean thinking about size in advance before allocation. If there is a need for flexible size list, the standard library is also explicit about whether the list is backed by an array or linked list, so that programmers are mindful about operation complexity.

  • Implicit property getter can be harmful

    Property as a programming language’s feature has been around for a while. I first got to use it while developing a multi-tenant cloud-based point of sale application on .NET platform. The idea is to avoid the verbosity of calling getter/setter methods by invoking them behind the scene whenever a field is accessed/assigned.

  • Prisoners of geography

    By Tim Marshall

  • The value of blockchain is in the hype it created

    I remained a cryptocurrency skeptics throughout the boom and burst cycle of 2017-2018. Cryptocurrency promises privacy, to displace financial institutions, remove the middle man and make transactions almost frictionless. In fact, there is no free lunch. Cryto transaction initiator needs to pay a gas fee as part of how the underlying algorithm works. Besides, the privacy that cryptocurrency enables would allows tax evader, money launderer to take advantage.

  • Calendar as a backward looking tool

    The digital calendar is often presented chiefly for its forward looking functionality which is to organize and follow up with things to come. A coming event is put on a chosen daily or hourly calendar slot. Reminders would fire up a few minutes prior so that we could not miss important happenings out of absent mindedness. Shiny calendars like Google’s act as personal assistant of some sort, which manage to fit regular workout sessions into a busy schedule.

Subscribe via RSS