Router is one of the most important feature or component in Web application framework,
ant it is also one of the performance bottlenecks of framework.
In this session, I'll show you how to make router much faster than ever.
Oktest - a new style testing library for Python -kwatch
Oktest is a new-style testing library for Python. It helps you to read & write tests very much. Oktest is available with (or without) standard 'unittest' module.
【DLゼミ】XFeat: Accelerated Features for Lightweight Image Matchingharmonylab
公開URL:https://arxiv.org/pdf/2404.19174
出典:Guilherme Potje, Felipe Cadar, Andre Araujo, Renato Martins, Erickson R. ascimento: XFeat: Accelerated Features for Lightweight Image Matching, Proceedings of the 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) (2023)
概要:リソース効率に優れた特徴点マッチングのための軽量なアーキテクチャ「XFeat(Accelerated Features)」を提案します。手法は、局所的な特徴点の検出、抽出、マッチングのための畳み込みニューラルネットワークの基本的な設計を再検討します。特に、リソースが限られたデバイス向けに迅速かつ堅牢なアルゴリズムが必要とされるため、解像度を可能な限り高く保ちながら、ネットワークのチャネル数を制限します。さらに、スパース下でのマッチングを選択できる設計となっており、ナビゲーションやARなどのアプリケーションに適しています。XFeatは、高速かつ同等以上の精度を実現し、一般的なラップトップのCPU上でリアルタイムで動作します。
セル生産方式におけるロボットの活用には様々な問題があるが,その一つとして 3 体以上の物体の組み立てが挙げられる.一般に,複数物体を同時に組み立てる際は,対象の部品をそれぞれロボットアームまたは治具でそれぞれ独立に保持することで組み立てを遂行すると考えられる.ただし,この方法ではロボットアームや治具を部品数と同じ数だけ必要とし,部品数が多いほどコスト面や設置スペースの関係で無駄が多くなる.この課題に対して音𣷓らは組み立て対象物に働く接触力等の解析により,治具等で固定されていない対象物が組み立て作業中に運動しにくい状態となる条件を求めた.すなわち,環境中の非把持対象物のロバスト性を考慮して,組み立て作業条件を検討している.本研究ではこの方策に基づいて,複数物体の組み立て作業を単腕マニピュレータで実行することを目的とする.このとき,対象物のロバスト性を考慮することで,仮組状態の複数物体を同時に扱う手法を提案する.作業対象としてパイプジョイントの組み立てを挙げ,簡易な道具を用いることで単腕マニピュレータで複数物体を同時に把持できることを示す.さらに,作業成功率の向上のために RGB-D カメラを用いた物体の位置検出に基づくロボット制御及び動作計画を実装する.
This paper discusses assembly operations using a single manipulator and a parallel gripper to simultaneously
grasp multiple objects and hold the group of temporarily assembled objects. Multiple robots and jigs generally operate
assembly tasks by constraining the target objects mechanically or geometrically to prevent them from moving. It is
necessary to analyze the physical interaction between the objects for such constraints to achieve the tasks with a single
gripper. In this paper, we focus on assembling pipe joints as an example and discuss constraining the motion of the
objects. Our demonstration shows that a simple tool can facilitate holding multiple objects with a single gripper.
42. copyright(c) 2013 kuwata-lab.com all rights reserved.
委譲
機能の一部 or 全部を、他のオブジェクトに任せ
ること(丸投げ!)
class Foo {
private $m1;
function __constructor() {
$this->other = new OtherObj();
}
function hello(arg) {
$this->other->hello(arg);
}
.... 丸投げ!
44. copyright(c) 2013 kuwata-lab.com all rights reserved.
プロトタイプチェーン
## 委譲と同様に、探索先を自分で設定可能
this.__proto__ = new Foo();
## 継承と同様に、自動的に探索してくれる
$this.hello();
$this.__proto__.hello();
$this.__proto__.__proto__.hello();
◆ プロトタイプチェーンは、委譲と継承の間の子
委譲の柔軟性と、継承の利便性を合わせ持つ
(注)独自の見解です
45. copyright(c) 2013 kuwata-lab.com all rights reserved.
継承では $this が変わらない
1: class Foo {
2: function hello() { ... }
3: function main() {
4: ...; $this->hello(); ...;
5: }
6: }
7: class Bar extends Foo {
8: function hello() {...} // override
9: // main() はそのまま
10: }
11: $obj = new Bar();
12: $obj->main();
$this は Bar オブ
ジェクトのまま!
オーバーライドした
Bar#hello() が最終的に
呼び出される
難しい話なので、分から
なければ読み飛ばして!
46. copyright(c) 2013 kuwata-lab.com all rights reserved.
委譲では $this が変わる
1: class Foo {
2: function hello() { ... }
3: function main() {
4: ...; $this->hello(); ...; }
5: }
6: class Bar extends Foo {
7: function hello() { ... }
8: function main() {
9: $this->foo->main(); }
10: }
11: $obj = new Bar();
12: $obj->foo = new Foo();
13: $obj->main();
この $this は
Bar ではない!
せっかく Bar#hello() を
新しく定義したのに
呼び出されない!
(Decorator patternでありがち)
Foo オブジェクト
が $this になる!
難しい話なので、分から
なければ読み飛ばして!
47. copyright(c) 2013 kuwata-lab.com all rights reserved.
対策: $this を引数として渡す
class Foo {
function hello() { ... }
function main($_this=null) {
if ($_this === null) $_this = $this;
...; $_this->hello(); ...;
}
}
class Bar {
var $foo = new Foo();
function hello() { ... }
function main() {
$this->foo->main($this); } }
こんな面倒なことを
全メソッドで行うの?
この用意をしてないクラス
は委譲先にできないの?
難しい話なので、分から
なければ読み飛ばして!
48. copyright(c) 2013 kuwata-lab.com all rights reserved.
プロトタイプチェーンでは this が変わらない
1: function Foo() {}
2: Foo.prototype.hello = function() {...};
3: Foo.prototype.main = function() {
4: ...; this.hello(); ...;
5: };
6:
7: function Bar() {}
8: Bar.prototype.hello = function() {...};
9:
10: var obj = new Bar();
11: obj.__proto__ = new Foo();
12: obj.main();
この this は Bar オ
ブジェクトのまま!
委譲と同じことしてるのに、
Bar#hello() が呼ばれる!
(Decorator pattern大勝利の気配!)
51. copyright(c) 2013 kuwata-lab.com all rights reserved.
間違ったクラス設計例
class 受注先 {
var $name;
var $addr;
function 納期回答();
}
class 発注先 {
var $name;
var $addr;
function 納期問合わせ();
}
「受注先かつ発注先」なら両方に登録が必要◆
実体は同じなのに一元管理されないため、名寄せが必要
自称DB設計上級者に
ありがちな間違い
52. copyright(c) 2013 kuwata-lab.com all rights reserved.
間違ったクラス設計例
class 取引先 {
var $name;
var $addr;
}
class 受注先 extends 取引先 {
function 納期回答();
}
class 発注先 extends 取引先 {
function 納期問合わせ();
}
class 受発注先 extends 受注先,発注先 { }
「受注先が発注先にJob Change!」を表せない◆
一度作ったオブジェクトのクラスは変更できないせい
自称Java上級者に
ありがちな間違い
ダイヤモンド継承!
53. copyright(c) 2013 kuwata-lab.com all rights reserved.
好ましいクラス設計例
class 取引先 { // Player
var $name;
var $addr;
var $受注先 = new 受注先();
var $発注先 = new 発注先();
}
class 受注先 { // Role
function 納期回答(); }
class 発注先 { // Role
function 納期問合わせ(); }
「Player」と「Role」とを分け、委譲を使う◆
「受注先かつ発注先」も「Job Change!」も自然に表現可能
でも、受注先や発注
先って、対応する取
引先オブジェクトが
必要だよね?
54. copyright(c) 2013 kuwata-lab.com all rights reserved.
より好ましいクラス設計例
class 取引先 { ... }
class Role {
var $player;
function __constructor($player) {
$this->player = $player;
}
}
class 受注先 extends Role { ... }
class 発注先 extends Role { ... }
「Role」が「Player」を保持する(さっきと逆)◆
Role には Player が必要だが、Player には Role は必須ではない
Role が Player を保持
(なぜなら Role には Player が必要だから)
55. copyright(c) 2013 kuwata-lab.com all rights reserved.
若干の問題点
// 受注先である取引先
$player = new 取引先('○ 商会');
$role = new 受注先($player);
// 受注先として扱う
echo $role->納期回答();
// 取引先として扱う
echo $role->player->name;
echo $player->name;
Role と Player で使い方に差がある◆
Player の属性やメソッドに Role からアクセスするとき
Role からは、Player の属性へ
直接にはアクセスできない
56. copyright(c) 2013 kuwata-lab.com all rights reserved.
そこでプロトタイプベース!
class 取引先 { ... }
class Role {
function __constructor($player) {
$this->player = $player;
$this->__proto__ = $player;
}
}
class 受注先 extends Role { ... }
class 発注先 extends Role { ... }
Role をあたかも Player のように扱える◆
Decorator Pattern も DCI もいらんかったんや!
仮に PHP でこれが
可能だとすると…
57. copyright(c) 2013 kuwata-lab.com all rights reserved.
そこでプロトタイプベース!
// 受注先 (Role) の役割をもった取引先 (Player) は、
$player = new 取引先('○ 商会');
$role = new 受注先($player);
// Role としても Player としても扱える
echo $role->納期回答();
echo $role->name;
// 複数の Role を重ねることさえ可能
$role = new 発注先($role); // 受注先兼発注先
Role をあたかも Player のように扱える◆
Decorator Pattern も DCI もいらんかったんや!
Role なのに、まるで
Player のように扱える!