Akka Streams (0.7) talk for the Tokyo Scala User Group, hosted by Dwango.
Akka streams are an reactive streams implementation which allows for asynchronous back-pressured processing of data in complext pipelines. This talk aims to highlight the details about how reactive streams work as well as some of the ideas behind akka streams.
Scala Refactoring for Fun and Profit (Japanese subtitles)Tomer Gabel
A talk given at Scala Matsuri 2016 in Tokyo, Japan.
New Scala practitioners often experience the uncomfortable feeling of "not quite getting it." If you've studied the syntax and written tests, maybe production code; if you're becoming comfortable with the language and libraries, but keep worrying that there's "a better way", or that your code isn't "idiomatic enough" - this session is for you.
By refactoring a real, live codebase, this talk will provide you with new tools and increased confidence. Between the provided examples and the ensuing discussion, you will walk away with a better feel for Scala and how to employ it in the real world.
セル生産方式におけるロボットの活用には様々な問題があるが,その一つとして 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.
【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上でリアルタイムで動作します。
9. Scalaz
• https://github.com/scalaz/scalaz
• キャッチフレーズ
• 昔: Scalaz: Type Classes and Pure Functional Data
Structures for Scala
• 今: An extension to the core Scala library for functional
programming. http://typelevel.org
• 最新の関数型プログラミングを可能にする機能群を
Scala向けに⽤用意
• 型クラス
• 純粋関数型データ構造
15. 代数的構造デザインパターン
• 半群 (semigroup)
• モノイド (monoid)
• 群 (group)
結合律律 (associative law)
• 可換半群
• 可換モノイド
• 可換群(アーベル群)
可換律律 (commutative law)
• 環 (ring)
• 体 (field)
分配律律 (distributive law)
(a + b) + c = a + (b + c)
a + b = b + a
a * (b + c) = a * b + a * c
20. A → B
• 関数の基本
• 型Aの値を型Bの値に置き換える (置き換えモデル,
substitution model)
• 副作⽤用はないので、A→Bの関数の外側にいかなる影響も
与えない (no side effect)
• 型Aの値が同じなら、いかなるタイミングで呼び出して
も型Bの同じ値が返る (参照透過性, referential
transparency)
• 圏論論:射(arrow, morphism)
• 論論理理学:ならば(imply)
• def f(x: A): B
21. A → B → C
• 引数が2つある関数
• 「A → B」の形の関数(引数が1つ)の合成で記述
• A → (B → C)
• Aを引数に取り「B→Cの関数」を返す関数
• def f(a: A, b: B): C
• def f(a: A)(b: B): C
• def f(a: A): B => C
• val f: A => B => C
22. A → A → A
• 「A → B → C」の特殊な形
• A, B, Cが同じ型
• ⼆二項演算⼦子
• f(x: A, y: A): A
• 1 + 1 → 2
• “abc” + “xyz” → “abcxyz”
• List(“abc”) ++ List(“xyz”) → List(“abc”, “xyz”)
33. 代数的データ型
• Algebraic data type
• 直積の直和の総和
• 再帰構造
case class Person(name: String, age: Int)
Case class Company(name: String, phone: String)
ケースクラスで直積を実現
Either[Person, Company]
Eitherで直積の直和を実現
sealedトレイトで直積の直和の総和を実現
sealed trait Party
case class Person(name: String, age: Int) extends Party
case class Company(name: String, phone: String) extends Party
42. scalaz stream
• com.everforth.lib.util.FileBag
for {
bag <- resource.managed(new FileBag())
bag2 <- resource.managed(new FileBag())
bag3 <- resource.managed(new FileBag())
} {
Process.constant(4096).through(io.chunkR(new URL("http://scala-
lang.org/").openStream)).to(bag.chunkW).run.run
bag.chunksR(4096).to(bag2.chunkW).run.run
bag2.linesR.map(_ +
"n").pipe(text.utf8Encode).to(bag3.chunkW).run.run
bag.size should be (bag2.size)
bag.size should be (bag3.size)
}
43. Spark
• RDD (Resilient Distributed Dataset)
• http://www.cs.berkeley.edu/~pwendell/strataconf/api/core/
spark/RDD.html
scala> val textFile = sc.textFile("README.md")
textFile: spark.RDD[String] = spark.MappedRDD@2ee9b6e3
scala> val linesWithSpark = textFile.filter(line =>
line.contains("Spark"))
linesWithSpark: spark.RDD[String] = spark.FilteredRDD@7dd4af09
scala> textFile.filter(line => line.contains("Spark")).count() // How
many lines contain "Spark"?
res3: Long = 15
44. RxJava - Scala
• Functional Reactive Programming
• https://github.com/Netflix/RxJava
• http://techblog.netflix.com/2013/02/rxjava-netflix-api.html
def simpleComposition() {
// fetch an asynchronous Observable<String>
// that emits 75 Strings of 'anotherValue_#'
customObservableNonBlocking()
// skip the first 10
.skip(10)
// take the next 5
.take(5)
// transform each String with the provided function
.map({ stringValue -> return stringValue + "_transformed"})
// subscribe to the sequence and print each transformed String
.subscribe({ println "onNext => " + it})
}