microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.71k stars 3.83k forks source link

lightgbm for learning to rank in image retrieval #3856

Closed wyfSunflower closed 3 years ago

wyfSunflower commented 3 years ago

Hi, Could anyone tell me how to use lgb train pointwise pairwise, listwise ranking model? Enter a picture and return the most similar pictures. Use vgg to extract the feature vectors of all images, how to use lightgbm to train the ranking model to learn the feature vectors of query image and similar images. All the query and retrieval images are embedded to such feature vector: [8.90005082e-02 3.88167053e-02 6.96463231e-03 2.24327501e-02 0.00000000e+00 6.89044036e-03 4.48297486e-02 1.29019067e-01 1.31079173e-02 5.03548123e-02 1.59571972e-02 3.32199503e-03 2.05789320e-02 0.00000000e+00 8.79884735e-02 3.83693203e-02 0.00000000e+00 6.27117325e-03 0.00000000e+00 1.29651483e-02 2.71258838e-02 5.71119552e-03 5.39046600e-02 7.89390132e-02 0.00000000e+00 0.00000000e+00 3.00873369e-02 5.51148430e-02 2.37327870e-02 2.69626603e-02 4.34620352e-03 0.00000000e+00 8.03562626e-03 0.00000000e+00 5.56077436e-03 1.38417084e-03 0.00000000e+00 5.47172204e-02 6.93293696e-05 5.29243201e-02 1.96293220e-02 1.20296486e-01 2.91618723e-02 0.00000000e+00 7.54267871e-02 7.18233921e-03 3.04820091e-02 3.96193638e-02 1.92113370e-02 4.96588908e-02 0.00000000e+00 6.05941825e-02 6.69099763e-03 3.57668288e-02 5.96812897e-05 1.04432013e-02 0.00000000e+00 6.54502632e-03 8.04956034e-02 0.00000000e+00 1.82151601e-01 2.09647957e-02 7.94205889e-02 0.00000000e+00 2.79833600e-02 8.15777667e-03 3.11750285e-02 3.84174660e-03 3.78177091e-02 0.00000000e+00 0.00000000e+00 1.75280508e-03 1.55537510e-02 3.60182561e-02 4.27553467e-02 1.85336601e-02 0.00000000e+00 1.36141434e-01 1.51005741e-02 0.00000000e+00 0.00000000e+00 3.17674913e-02 3.46376747e-02 0.00000000e+00 2.54655257e-03 1.78025551e-02 2.49271356e-02 4.33275998e-02 7.18120998e-03 1.34304818e-03 0.00000000e+00 0.00000000e+00 8.38903934e-02 2.37188432e-02 1.01237455e-02 1.61224063e-02 4.98712063e-02 4.71702479e-02 2.49730144e-02 2.98559014e-02 0.00000000e+00 1.20014111e-02 1.07575886e-01 1.07071679e-02 1.72374435e-02 7.37625221e-03 2.55540609e-02 0.00000000e+00 4.42439271e-03 5.56757348e-03 1.79643892e-02 0.00000000e+00 4.55027930e-02 1.73768383e-02 3.82002257e-02 3.52678751e-03 0.00000000e+00 8.46929196e-03 3.81525513e-03 2.92479433e-02 3.21169496e-02 6.08678013e-02 0.00000000e+00 2.20204685e-02 7.81516451e-03 1.55833559e-02 0.00000000e+00 6.18150225e-03 0.00000000e+00 3.34983170e-02 3.63071598e-02 8.02642405e-02 2.19742768e-02 0.00000000e+00 0.00000000e+00 0.00000000e+00 3.92772909e-03 4.11796160e-02 2.86727175e-02 0.00000000e+00 2.23326404e-02 0.00000000e+00 3.32523249e-02 2.03779079e-02 4.68392856e-02 0.00000000e+00 1.69373322e-02 2.08543673e-01 1.06218206e-02 1.80435684e-02 3.20698204e-03 2.46865284e-02 1.63367428e-02 0.00000000e+00 3.65217254e-02 2.22887285e-02 8.00593174e-04 4.36695069e-02 0.00000000e+00 3.47070247e-02 1.11100394e-02 6.39100745e-02 8.31619054e-02 5.87043213e-03 0.00000000e+00 2.65214662e-03 0.00000000e+00 0.00000000e+00 6.13786699e-03 0.00000000e+00 0.00000000e+00 1.09989243e-02 4.21297327e-02 4.58147712e-02 1.05538229e-02 2.66314372e-02 4.53935601e-02 0.00000000e+00 8.34240094e-02 9.93594807e-03 5.00303172e-02 2.34566480e-02 5.41769639e-02 1.32154468e-02 5.49667887e-02 0.00000000e+00 3.28997173e-03 1.14257239e-01 2.28627279e-01 0.00000000e+00 1.18910305e-01 0.00000000e+00 1.15498528e-02 0.00000000e+00 3.69933955e-02 2.45182347e-02 3.86850797e-02 3.98665108e-02 0.00000000e+00 0.00000000e+00 0.00000000e+00 3.33192721e-02 3.12152668e-03 3.63338776e-02 3.53911445e-02 0.00000000e+00 1.01566158e-01 7.07906066e-03 0.00000000e+00 0.00000000e+00 1.57150701e-02 0.00000000e+00 4.28244192e-03 3.80682983e-02 1.57243479e-02 1.81342531e-02 8.70498121e-02 7.77690113e-02 1.27245009e-01 4.75826561e-02 3.01382411e-02 6.74438104e-02 3.77385989e-02 5.39631909e-03 0.00000000e+00 2.81960778e-02 5.84457889e-02 2.77666450e-02 5.70307896e-02 4.41555046e-02 3.45186330e-02 4.11279574e-02 4.17852886e-02 1.58158597e-02 0.00000000e+00 4.89845015e-02 0.00000000e+00 4.25516665e-02 6.19804161e-03 0.00000000e+00 1.55548789e-02 3.98595221e-02 1.43625196e-02 5.59298396e-02 8.39086436e-03 0.00000000e+00 1.58605296e-02 0.00000000e+00 0.00000000e+00 9.00901556e-02 2.71870545e-03 0.00000000e+00 4.88676876e-02 5.53816976e-03 1.24056758e-02 0.00000000e+00 1.58182101e-03 1.02066193e-02 7.52693135e-03 2.56582648e-02 2.85210344e-03 2.84158401e-02 2.59339251e-02 3.86336632e-02 1.50714457e-01 0.00000000e+00 1.80731937e-02 1.97570205e-01 0.00000000e+00 7.98103400e-04 0.00000000e+00 2.53048148e-02 3.04783843e-02 5.19203171e-02 0.00000000e+00 0.00000000e+00 1.01025060e-01 0.00000000e+00 0.00000000e+00 3.03813498e-02 1.85464751e-02 8.41837190e-03 1.83409192e-02 1.36659518e-02 1.16417436e-02 5.71147799e-02 0.00000000e+00 1.26540139e-01 2.08592154e-02 0.00000000e+00 3.71049382e-02 2.15727948e-02 0.00000000e+00 4.71437834e-02 5.17352335e-02 4.19546477e-02 8.16675648e-03 0.00000000e+00 3.62660624e-02 6.25387281e-02 3.92251536e-02 0.00000000e+00 5.22601604e-02 0.00000000e+00 0.00000000e+00 2.42215563e-02 1.48823068e-01 9.82411578e-03 2.41716597e-02 3.19464020e-02 0.00000000e+00 0.00000000e+00 1.59950256e-02 0.00000000e+00 2.49793138e-02 1.22838067e-02 2.35655792e-02 2.03555860e-02 0.00000000e+00 4.08915952e-02 1.96850169e-02 1.60348006e-02 2.53400076e-02 1.49884066e-02 5.90177923e-02 0.00000000e+00 1.50937978e-02 2.56023109e-02 2.87300702e-02 0.00000000e+00 1.95157938e-02 1.12570757e-02 8.16665143e-02 8.66563991e-03 9.40719433e-03 3.64117138e-02 2.33304705e-02 9.50961486e-02 2.51183305e-02 1.98915564e-02 0.00000000e+00 8.15780312e-02 2.83713527e-02 3.12576145e-02 1.31974546e-02 0.00000000e+00 1.24269333e-02 1.49414884e-02 9.84067842e-02 1.16388306e-01 4.90143709e-02 0.00000000e+00 5.61655201e-02 1.89518351e-02 2.20198669e-02 1.60419457e-02 3.11701205e-02 4.72726002e-02 0.00000000e+00 1.46364689e-01 7.61504024e-02 1.61874518e-02 3.94973159e-02 2.91211326e-02 0.00000000e+00 0.00000000e+00 2.11530160e-02 1.67828873e-02 1.26647547e-01 2.87997499e-02 0.00000000e+00 2.05061845e-02 1.81248467e-02 3.63801979e-02 2.94447560e-02 3.89760663e-03 1.12531167e-02 1.86926275e-02 1.60639733e-02 5.89654446e-02 1.16099762e-02 9.88679472e-03 7.13268891e-02 0.00000000e+00 1.82192642e-02 0.00000000e+00 0.00000000e+00 4.41532731e-02 6.80467486e-02 0.00000000e+00 9.22206044e-03 3.18805850e-03 0.00000000e+00 2.82119922e-02 7.54790157e-02 9.99167189e-02 3.91946500e-03 8.87915492e-03 2.96734441e-02 1.50058623e-02 3.89126018e-02 2.53515784e-02 7.48361228e-04 0.00000000e+00 6.60900548e-02 3.58007215e-02 2.07147710e-02 5.59371747e-02 1.42010171e-02 3.55089903e-02 3.53903957e-02 0.00000000e+00 3.74214835e-02 3.50901969e-02 0.00000000e+00 3.56437787e-02 1.53941745e-02 7.01834401e-03 0.00000000e+00 8.93659368e-02 5.79317398e-02 9.11795255e-03 6.13395385e-02 8.06286633e-02 7.03362748e-02 1.87895726e-02 6.02796033e-04 6.45736530e-02 9.85945016e-02 7.75829256e-02 1.21362798e-01 2.94872485e-02 8.85931402e-03 0.00000000e+00 5.04097044e-02 6.61889762e-02 1.17772156e-02 0.00000000e+00 9.96324606e-03 1.18845820e-01 2.72974279e-02 1.92205086e-02 7.98257962e-02 5.52891940e-02 1.89647004e-02 8.65882486e-02 0.00000000e+00 4.14343318e-03 5.94880804e-02 6.97259046e-03 2.77441144e-02 6.71483204e-03 0.00000000e+00 3.83522063e-02 5.93059324e-02 0.00000000e+00 3.77363227e-02 5.02448268e-02 5.25560137e-03 0.00000000e+00 3.13122161e-02 1.71017107e-02 1.80270988e-02 8.66254140e-03 1.23135569e-02 5.25539033e-02 6.23547621e-02 2.02372987e-02 6.39977381e-02 2.95881238e-02 5.71416318e-02 7.25320280e-02 3.38840671e-02 0.00000000e+00 0.00000000e+00 4.04593311e-02 1.47404820e-01 4.45124023e-02 7.08045289e-02 6.25219494e-02 4.14818153e-02 1.06148440e-02 3.97012606e-02 1.46108838e-02 4.33592685e-03 0.00000000e+00 3.71895060e-02 4.34653321e-03 2.29720455e-02 0.00000000e+00 0.00000000e+00 6.54528290e-02 4.00850661e-02 0.00000000e+00 3.50454301e-02 3.92428450e-02 4.40435261e-02 8.32329621e-04 1.44808311e-02 2.02326272e-02 1.52434250e-02 3.59235401e-03 3.38842943e-02 9.79979616e-03 1.30387153e-02 3.31037827e-02 0.00000000e+00 8.69604852e-03 3.80632132e-02 0.00000000e+00 2.79067624e-02 6.58166315e-03] Thanks!

StrikerRUS commented 3 years ago

You can manually label your images (feature vectors after VGG) first and then train LightGBM with ranking objective. https://everdark.github.io/k9/notebooks/ml/learning_to_rank/learning_to_rank.html

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.