FPN for Object Detection

My notes of reading this paper.

FPN stands for Feature Pyramid Network, used for improving Object Detection.

One traditional way to do Object Detection is to use sliding window with multiple window sizes which is in (a). However this method is slow and computational intensive. (b) and (c) are mentioned for approaches that used by others to overcome the disadvantage of (a).

The author also mentioned that a deep ConvNet can generate multiple scale features by sampling. However these feature maps for different spatial resolutions have large gaps which can harm the result.

(d) is the method this paper is promoting.

Resolution and semantic of feature :

Bottom-up, up-down path way and lateral connections

Bottom-up pathway is a regular ConvNet backbone with scale step=2(ResNet here), Up-down pathway is scaling up with step size=2 (with nearest neighbor upsampling).

When adding the Bottom-up layer to the Up-down layer, the Bottom-up layer on the left has x2 times more channels, so it uses Conv 1×1 to reduce channel number to add the layer on the right by element wise. The up-down layer on the right has to upsample (x2) to match the hight and width of the left. The upsample can cause aliasing effect. Conv 3×3 is used to reduce this aliasing effect.

Code can find found here. Also thanks to this video for better understanding.

Nested X Server

Use Xephyr to run a second X window with 8bit color depth in Raspberry Pi
https://nims11.wordpress.com/2012/06/24/nested-x-servers-with-xephyr/

Xephyr -ac -screen 800x600x8 -reset :1 &

This will open a blank window
In the original window, type
DISPLAY=:1

Then run the C program. It show “Colomap_size: 256”.
It worked!

Setup SSL for MySQL replication

MySQL replication is setup already. Now I need to add SSL so the communication between server and client will be secure.

1. generate CA certificate and server key/cert on Master

CA certificate
openssl genrsa 2048 > ca-key.pem
openssl req -new -x509 -nodes -days 1000 -key ca-key.pem -out ca-cert.pem

Server Key/Cert
openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem -out server-req.pem
openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem

2. enable SSL on master
add the following to both [client] and [mysqld]

ssl-ca=/var/lib/mysql/ssl/ca-cert.pem
ssl-cert=/var/lib/mysql/ssl/client-cert.pem
ssl-key=/var/lib/mysql/ssl/client-key.pem

3. generate client key/cert on Slave

openssl req -newkey rsa:2048 -days 1000 -nodes -keyout client-key.pem -out client-req.pem
openssl x509 -req -in client-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem

4. enable SSL on slave
repeat 2, but on slave server and using keys/cert of slave, restart db with skip-slave-start

5. start slave

mysql>change master to master_host=’masterdb’, master_user=’repliuser’, master_password=’pass’,master_log_file=’db1-bin.xxxxx’, master_log_pos=98, MASTER_SSL=1, MASTER_SSL_CA=’ssl/ca-cert.pem’;
start slave

6. setup User permission to use SSL only
User “GRANT” to setup user allow SSL connection only

Check if SSL is on in mysqld

mysql> show variables like ‘%have_ssl%’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| have_ssl | YES |
+—————+——-+

Check if Client is using SSL:

>mysql
SHOW STATUS LIKE ‘Ssl_cipher’;

mysql logging

There’re 2 ways to enable mysql query logs

in /etc/my.cnf

log=/var/log/mysqld-query.log

or add ” –log” in start script

/usr/bin/mysqld_safe –datadir=”$datadir” …. –log >/dev/null 2>&1 &

How to stop binary log
remove the following from my.cnf

log-bin=mysql-bin
binlog_format=mixed