<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://darkthecross.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://darkthecross.com/" rel="alternate" type="text/html" /><updated>2026-08-14T18:33:35+00:00</updated><id>https://darkthecross.com/feed.xml</id><title type="html">Any sufficiently advanced technology is indistinguishable from magic.</title><subtitle>This is the personal website of Mingxiang Fan (AKA darkthecross).</subtitle><author><name>Mingxiang Fan</name></author><entry><title type="html">Iterative LQR planner</title><link href="https://darkthecross.com/blog/2020/12/25/iterative-lqr-planner/" rel="alternate" type="text/html" title="Iterative LQR planner" /><published>2020-12-25T07:52:31+00:00</published><updated>2020-12-25T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2020/12/25/mobile_planner</id><content type="html" xml:base="https://darkthecross.com/blog/2020/12/25/iterative-lqr-planner/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-6">
            <p>
                So, in practical mobile robot motion planning, we want to have a nice trajectory, which does not only avoids collision with other agents, but is 
                also kinematically feasible.
            </p>
            <p>
                To achieve this, we can use optimization based algorithms. Given a feasible initial trajectory, and properly bootstraped costs, we are able to get the optimal 
                trajectory with iterative linear quadratic regulation. 
            </p>
            <p>
                We're basically able to define cost of any shape, on any kinematic terms, including position, velocity and even acceleration. In iterative LQR, we find the local
                quadratic approximation of the cost functions, and run LQR to get the input of the next iteration. We can end the iteration based on some criterial, like absolute 
                tolerance or relative tolerance -- if the optimization step can not change the trajectory much, we should be very close to the minima. Or the local minima :/
            </p>
        </div>
        <div class="col-6">
            <img class="card-img-top" src="/assets/posts_img/mobile_planner/math1.png" alt="">
        </div>

    </div>

    <div class="row">
        <div class="col-md-3">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/mobile_planner/mobile_optimizer.gif" alt="">
            </div>
        </div>
        <div class="col-9">
            <p>
                As shown in the gif to the left, with the zero control initialization, we found a trajectory which stayed away from the objects. Things could be trickier if we 
                have different type of costs, or if we have worse initialization (which may drive the car off the road in the worst cases).
            </p>
        </div>
    </div>

</div>]]></content><author><name>Mingxiang Fan</name></author><category term="Robotics" /><category term="robotics" /><category term="motion-planning" /><category term="ilqr" /><summary type="html"><![CDATA[Iterative LQR, with zero control initialization and self-defined potential. Should be safe to use if you want to build a self driving car.]]></summary></entry><entry><title type="html">Image Super Resolution</title><link href="https://darkthecross.com/blog/2020/12/25/image-super-resolution/" rel="alternate" type="text/html" title="Image Super Resolution" /><published>2020-12-25T07:02:31+00:00</published><updated>2020-12-25T07:02:31+00:00</updated><id>https://darkthecross.com/blog/2020/12/25/super_resolution</id><content type="html" xml:base="https://darkthecross.com/blog/2020/12/25/image-super-resolution/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-9">
            <p>
                I recently bought an RTX 3090 graphics card. It has 24G memory, which should be able to handle STOA CNNs in 2016 or 2017. So why don't us feed a lot of images 
                to this beast and let it learn something...
            </p>
            <p>
                A good thing to try is super resolution for videos. Some videos, especially old ones, are often of bad resolution, and if we can recover them with ML models, it 
                would be great.
            </p>
            <p>
                The network structure was based on this <a class="text-muted" href="http://krasserm.github.io/2019/09/04/super-resolution/" target="_blank">webpage</a>, which has ~300k params. 
                Let's try on a single image first...
            </p>
            <p>
                Turned out that the trained model was able to recover the image slightly better than cubic interpolation...
            </p>
            <img class="img-fluid" src="/assets/posts_img/image_super_resolution/eval_2.png" />
            <p class="mt-3">
                Well, we should also try if this works with video. Feeding 5 consecutive frames into the neural network... (See github for network details). And it did not work, the error was even larger 
                than recovering from a single image, and that's bad. For ML systems, it happends.
            </p>
        </div>
        <div class="col-3">
            <img class="img-fluid" src="/assets/posts_img/image_super_resolution/edsr.png" />
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="ML" /><category term="ml" /><category term="computer-vision" /><category term="super-resolution" /><summary type="html"><![CDATA[Deep learning, CNN.]]></summary></entry><entry><title type="html">Starlight Voyage</title><link href="https://darkthecross.com/blog/2019/12/28/starlight-voyage/" rel="alternate" type="text/html" title="Starlight Voyage" /><published>2019-12-28T07:52:31+00:00</published><updated>2019-12-28T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2019/12/28/starlight_voyage</id><content type="html" xml:base="https://darkthecross.com/blog/2019/12/28/starlight-voyage/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-12">
            <p>
                Indie wechat mini games were once very popular among my friends, and I tried to implement a 
                new game -- something bouncing between balls and bars, and sometimes attracted by black holes. 
                Truned out to be a quite boring game, but I got the chance to implement the whole 2d physics engine,
                which was pretty cool.
            </p>
            <p>
                This also exposed me to some very interesting technologies. Tencent has their own implementation of 
                canvas interfaces and node servers, while there're multiple players in the wechat eco system, some of 
                which offer pretty cool game engines. There're also companies which are making millions from wechat mini games. 
                Thus, it was just too late for indie games.
            </p>
            <p>
                I though about at least releasing it, but Tencent asked me for lots of documents, including certification of 
                software copyrights, which can only be obtained by visiting some government agency in Beijing. I did not have
                any recent travel plans and did not want to bother someone to do this for me, thus it was never released. 
            </p>
            <p>
                And recently I want to set up a wechat subscription account to write something about cooking, building PCs and other stuffs 
                happening in my life. I have to delete the wechat mini game, since it was binded to my wechat account. Here's the epitaph of 
                Starlight Voyage.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-sm">
            <img class="card-img-top" src="/assets/posts_img/starlight_voyage/sv1.png" alt="">
        </div>
        <div class="col-sm">
            <img class="card-img-top" src="/assets/posts_img/starlight_voyage/sv2.png" alt="">
        </div>
        <div class="col-sm">
            <img class="card-img-top" src="/assets/posts_img/starlight_voyage/sv3.png" alt="">
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="Casual" /><category term="casual" /><category term="javascript" /><category term="game" /><summary type="html"><![CDATA[Wechat mini game, implemented with javascript.]]></summary></entry><entry><title type="html">Balance Car</title><link href="https://darkthecross.com/blog/2019/07/24/balance-car/" rel="alternate" type="text/html" title="Balance Car" /><published>2019-07-24T07:52:31+00:00</published><updated>2019-07-24T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2019/07/24/balance_car</id><content type="html" xml:base="https://darkthecross.com/blog/2019/07/24/balance-car/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-7">
            <p>
                It would be super cool to implement some algorithm on real hardware! Thus I bought a toolkit for 
                a balance car from <a href="https://miaowlabs.com/" target="_blank" class="text-muted">MiaoWLab</a> and started building a balance car. 
                The first step would definitely be testing the algorithm in simulation. I created the URDF file for the balance car, 
                and tested (and tuned) my PID control algorithm with pybullet.
            </p>
        </div>
        <div class="col-md-5">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/balance_car/balance_car_sim.gif" alt="">
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-3">
            <video class="embed-responsive-item" controls autoplay muted>
                <source src="/assets/posts_img/balance_car/balance_car_real.MP4" type="video/mp4">
                Your browser does not support the video tag.
              </video>
        </div>
        <div class="col-9">
            <p>
                The next step is to implement the algorithm in C, and upload it to the embedded system. Yes, raw C, yes,
                 upload through Keli, into a C51-like single chip microcomputer. Luckily, with the IMU and the pre-defined 
                 control interface for the wheels, it was not super hard to do this. And it worked!
            </p>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="Robotics" /><category term="robotics" /><category term="controls" /><category term="embedded" /><summary type="html"><![CDATA[PID control, embedded system]]></summary></entry><entry><title type="html">Single Image Depth Estimation</title><link href="https://darkthecross.com/blog/2018/08/03/single-image-depth-estimation/" rel="alternate" type="text/html" title="Single Image Depth Estimation" /><published>2018-08-03T07:52:31+00:00</published><updated>2018-08-03T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2018/08/03/single_image_depth_estimation</id><content type="html" xml:base="https://darkthecross.com/blog/2018/08/03/single-image-depth-estimation/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-12">
            <p>
                In this project, we aimed to solve the problem of estimating depth information from single images.
                We tested our algorithms on both Kinect style data and correlating RGB image and Lidar data.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                Many sorts of deep neural networks was covered in this project,
                but we found that the network structure from
                <a
                    href="http://papers.nips.cc/paper/5539-depth-map-prediction-from-a-single-image-using-a-multi-scale-deep-network.pdf" class="text-muted" target="_blank">Eigen,
                    et.al</a>
                worked best. We finally settled down and used a similiar network structure.
            </p>

        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <img class="img-fluid" src="/assets/posts_img/single_image_depth_estimation/network.png" />
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                And we achieved acceptable results on different datasets.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <table class="table">
                <thead>
                    <tr>
                        <th scope="col" class="text-muted">Origin Image</th>
                        <th scope="col" class="text-muted">Ground Truth</th>
                        <th scope="col" class="text-muted">Predicted Depth</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            <img src="/assets/posts_img/single_image_depth_estimation/0_origin_rgb.jpg"
                                class="img-thumbnail img-fluid">
                        </td>
                        <td>
                            <img src="/assets/posts_img/single_image_depth_estimation/0_origin_dps.jpg"
                                class="img-thumbnail img-fluid">
                        </td>
                        <td>
                            <img src="/assets/posts_img/single_image_depth_estimation/0_predicted_dps.jpg"
                                class="img-thumbnail img-fluid">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-12">
            <p>
                We also have a <a class="text-muted" href="/assets/posts_img/single_image_depth_estimation/single-image-depth.pdf"
                    target="_blank">pdf version of project report </a> including different metrics.
            </p>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="ML" /><category term="ml" /><category term="computer-vision" /><category term="depth-estimation" /><summary type="html"><![CDATA[Deep learning, CNN.]]></summary></entry><entry><title type="html">RL Experiments</title><link href="https://darkthecross.com/blog/2018/08/02/rl-experiments/" rel="alternate" type="text/html" title="RL Experiments" /><published>2018-08-02T07:52:31+00:00</published><updated>2018-08-02T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2018/08/02/rl_experiments</id><content type="html" xml:base="https://darkthecross.com/blog/2018/08/02/rl-experiments/"><![CDATA[<div class="container">

    <div class="row">

        <div class="col-12">
            <p>
                I worked on this project to get some basic knowledge of reinforcement learning and have some fun solving problems automatically.
                All three problems in this project was solved using Q learning.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-9">
            <pre>
                <code>
    Algorithm double_q_learning:
        initialize Q_1 = Q_2, memory_deque = []
        initialize explore_rate = 1, time_step = 0
        initialize state
        repeat:
            action = select from (random_action, argmax(state, Q_1)) with explore_rate
            new_state, reward, done = environment.step(action)
            memory_deque.append( (state, action, new_state, reward, done) )
            time_step += 1
            explore_rate = max(explore_rate * explore_rate_decay, explore_rate_min)
            if time_step % update_q2_steps == 0:
                train_batch = sample(memory_deque)
                q_val = bellman_qeuation(train_batch)
                Q_2 = Q_2 + back_propagation(q_val)
            if time_step % update_q1_steps == 0:
                Q_1 = Q_2
        until avg_game_reward > threshold
                </code>
            </pre>
        </div>
        <div class="col-3">
            <img src="/assets/posts_img/rl_experiments/pong.gif">
        </div>
    </div>

    <div class="row">

        <div class="col-12">
            <p>
                I used the template code from the
                <a class="text-muted" href="https://github.com/berkeleydeeprlcourse/homework" target="_blank">UCB RL course homework</a>
                to solve the Atari games. It is a deep Q learning algorithm, with some best practice, including double Q networks. The agent
                constantly achieved a average reward of over 20 on Pong-v0 after 4.3M of game steps.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                The cart-pole problem should be the easiest and most common one. Nothing mysterious here. It was solved in 456 steps, which
                is a pretty good (and lucky) score for q learning.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                I also developed an apple-picker game environment, a easy problem to apply deep Q learning with convolutional neural network,
                to test the code implementation. The problem was solved relatively easy, and should be a good start point
                for complex problems.

            </p>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="ML" /><category term="ml" /><category term="reinforcement-learning" /><summary type="html"><![CDATA[Reinforcement learning, DQN.]]></summary></entry><entry><title type="html">Vehicle Detection</title><link href="https://darkthecross.com/blog/2018/08/01/vehicle-detection/" rel="alternate" type="text/html" title="Vehicle Detection" /><published>2018-08-01T07:52:31+00:00</published><updated>2018-08-01T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2018/08/01/vehicle_detection</id><content type="html" xml:base="https://darkthecross.com/blog/2018/08/01/vehicle-detection/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-12">
            <p>
            This project is a part of the final project of the University of Michigan EECS 599 Autonomous Driving course.
            The project was submitted, competed and rated as a
            <a class="text-muted" href="https://www.kaggle.com/c/rob599-f2017-project-task1" target="_blank"> Kaggle competition </a>. Our group got 6th out of 35 different groups.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                The dataset includes RGB images and correlated lidar depth information from simulated scenes.
                I guess it was from GTA5 or using similar game engine. A very frustrating thing in this project was that, only
                mid-sized cars, compact cars or SUVs were our target of detection, which means we need to distinct van and trucks,
                and do not report them in our results.
            </p>
        </div>
    </div>

    <div class="row">
            <div class="col-12">
                <p>
                    We transformed the lidar information
                    to the same size of a layer of the RGB image using bilateral filter ,
                    and fine tuned the network from pretrained yolo-v2 from darknet.
                </p>
            </div>
        </div>

    <div class="row">
        <div class="col-12">
            <img class="img-fluid" src="/assets/posts_img/vehicle_detection/predictions.jpg" />
        </div>
    </div>
    <div class="row">
            <div class="col-12">
                <p>
                    You can also find our <a class="text-muted" href="/assets/posts_img/vehicle_detection/599_report.pdf" target="_blank">pdf report </a> in which we reported the details of the project.
                </p>
            </div>
        </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="ML" /><category term="ml" /><category term="computer-vision" /><category term="yolo" /><summary type="html"><![CDATA[Deep learning, CNN, yolo-v2.]]></summary></entry><entry><title type="html">Car RRT Path Planning</title><link href="https://darkthecross.com/blog/2018/07/31/car-rrt-path-planning/" rel="alternate" type="text/html" title="Car RRT Path Planning" /><published>2018-07-31T08:02:31+00:00</published><updated>2018-07-31T08:02:31+00:00</updated><id>https://darkthecross.com/blog/2018/07/31/car_rrt_path_planning</id><content type="html" xml:base="https://darkthecross.com/blog/2018/07/31/car-rrt-path-planning/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-md-3">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/car_rrt_path_planning/rrt_small.gif" alt="">
            </div>
        </div>
        <div class="col-md-3">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/car_rrt_path_planning/img2.png" alt="">
            </div>
        </div>
        <div class="col-md-3">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/car_rrt_path_planning/map3.png" alt="">
            </div>
        </div>
        <div class="col-md-3">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/car_rrt_path_planning/map3_solved.png" alt="">
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                I saw an interesting image on the book <span class="font-italic">Planning Algorithms</span>,
                showing the path planning result for a car which can only turn left to drive through a complex
                environment.
                Thus I want to do the non-holonomic planning by myself.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                So the first step should be implementing an RRT. And to achieve good execution time of fining closest nodes, 
                it is neccesary to implement an underlying kd-tree.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                Then we need a local planner which could give us a feasible solution for simple situations.
                It is not hard to derive a method to plan a path using the series of circles which lies
                to the left of the initial and terminal states. Just find the tangent circles, since we
                do not really need to guarantee to find a solution or find the optimal solution.
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-12">
            <p>
                And it worked. Although since there's nothing to tell the car that we do not want to go reverse, the planned trajectory was full 
                of segments of driving reverse :)
            </p>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="Robotics" /><category term="robotics" /><category term="motion-planning" /><category term="rrt" /><summary type="html"><![CDATA[Non-holonomic motion planning, rapidly-exploring random tree.]]></summary></entry><entry><title type="html">MNIST GAN</title><link href="https://darkthecross.com/blog/2018/07/31/mnist-gan/" rel="alternate" type="text/html" title="MNIST GAN" /><published>2018-07-31T07:52:31+00:00</published><updated>2018-07-31T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2018/07/31/mnist_gan</id><content type="html" xml:base="https://darkthecross.com/blog/2018/07/31/mnist-gan/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-7">
            <p>
                Generative Adversarial Network is really a cool stuff, enabling human to use machine
                learning to generate a series of images, which are merely distinguishable from some real
                images.
            </p>
            <p>
                This project is just a toy project for GAN. I'm building a generative neural network and
                 a discriminative neural network, to automatically generate a MNIST image which represents
                 number 9.
            </p>
        </div>
        <div class="col-md-5">
            <div class="card mb-4 shadow-sm project-img">
                <img class="card-img-top" src="/assets/posts_img/mnist_gan/gan.gif" alt="">
            </div>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="ML" /><category term="ml" /><category term="gan" /><category term="deep-learning" /><summary type="html"><![CDATA[Generative Adversarial Network, Deep Learning]]></summary></entry><entry><title type="html">Random Bin Picking</title><link href="https://darkthecross.com/blog/2018/07/30/random-bin-picking/" rel="alternate" type="text/html" title="Random Bin Picking" /><published>2018-07-30T07:52:31+00:00</published><updated>2018-07-30T07:52:31+00:00</updated><id>https://darkthecross.com/blog/2018/07/30/random_bin_picking</id><content type="html" xml:base="https://darkthecross.com/blog/2018/07/30/random-bin-picking/"><![CDATA[<div class="container">
    <div class="row">
        <div class="col-md-8">
            <p>
            I interned at Mechmind robotics in Beijing in the summer at 2017, where I worked with the robotics algorithms working on real industrial robots.
            </p>
            <p>
            As a robot algorithm engineer, my work included:
            </p>
            <ul>
                <li>
                    Implemented the inverse kinematics algorithm for ABB-IRB4600 robot, a large one with over 60kg capacity.
                    The code is still working well on real robots!
                </li>
                <li>
                    Designed an algorithm to detect and avoid sigularity points during the motion planning of ABB-IRB1200 and ABB_IRB4600.
                </li>
                <li>
                    Implemented the collision detection of robot motion planning using <a href="https://github.com/flexible-collision-library/fcl" target="_blank" class="text-muted"> fcl </a> and
                    integrated into the software product of the company.
                </li>
                <li>
                    implemented quaternion interpolation algorithm to enable smooth motion of the industrial robots.
                </li>
            </ul>
        </div>
        <div class="col-md-4">
            <img class="img-fluid img-thumbnail" src="/assets/posts_img/random_bin_picking/photo.png" >
        </div>
    </div>
    <hr />
    <div class="row">
        <div class="col-12">
            <p class="text-muted">
                The usage of all related pictures on this personal website are authorized by Mechmind robotics.
            </p>
        </div>
    </div>
</div>]]></content><author><name>Mingxiang Fan</name></author><category term="Robotics" /><category term="robotics" /><category term="motion-planning" /><category term="manipulation" /><summary type="html"><![CDATA[Inverse kinematics, singularity detection, motion planning, Lie algebra.]]></summary></entry></feed>