問題タブ [subsampling]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - 長方形の画像に重なり合う正方形のパッチを作成する
長方形の画像img
とパッチが与えられますs
。s
ここで、最小数のパッチを使用して、すべてのピクセルがimg
少なくとも 1 つのパッチに含まれるように、画像全体を辺の長さの正方形のパッチでカバーしたいと考えています。さらに、隣接するパッチの重なりをできるだけ少なくしたいと考えています。
これまでのところ: 以下にコードを含め、例を作成しました。ただし、まだ完全には機能しません。うまくいけば、誰かがエラーを見つけます。
例: 与えられimg
た形状:(4616, 3016)
そして、s = 224
つまり、長辺に 21 パッチ、幅の狭い側に 14 パッチ、合計で 21*14 = 294 パッチになります。
今、パッチ間のオーバーラップを分散する方法を見つけようとしています。私のパッチはサイズの画像をカバーできます: (4704, 3136)
、したがって、高さの私のパッチは 88 個の重複するピクセルをカバーする必要がありmissing_h = ht * s - h
、幅は類似しています。
今、私は 21 個のパッチに 88 ピクセルを分配する方法を理解しようとしています。88 = 4* 21 + 4 したがってhso = 17
、オーバーラップ のあるパッチshso = 4
とhbo = 4
オーバーラップ 5 のパッチがあり、幅は類似しています。
これで、画像全体をループして、現在の位置を追跡するだけ(cur_h, cur_w)
です。各ループの後、調整しcur_h, cur_w
ます。s
現在のパッチ番号はi, j
、パッチのオーバーラップが小さいか大きいかを示しています。
python - Gensim word2vec ダウンサンプリング サンプル=0
Gensim sample= 0
word2vec では、トレーニング中にダウンサンプリングが使用されていないということですか? ドキュメントはまさにそれを言っています
「有用な範囲は (0, 1e-5) です」
ただし、しきい値を 0 にすると、P(wi) が 1 に等しくなり、単語が破棄されないことを意味します。これは正しく理解できているでしょうか?
私は 7597 件の Facebook 投稿 (18945 ワード) の比較的小さなデータセットに取り組んでおりsample= 0
、推奨範囲内の他のものよりも、埋め込みのパフォーマンスがはるかに優れています。特に理由はありますか?文字サイズ?
python - Subsampling a 1D array of integer so that the sum hits a target value in python
I have two 1D arrays of integers whose some differ, for example:
I would like the sum of each array to be equal to that of the smallest of the two. However I want to keep values as integers, not floats, so dividing is not an option. The solution appears to be some subsampling of the biggest array so that its sum is equal to that of the smallest one:
However, I cannot find a function that would perform such subsampling. The only one I found are in scipy but they seem dedicated to treat audio signal. The alternative was a function of the scikit-bio package but it does not work on Python 3.7.