RandLA-Net icon indicating copy to clipboard operation
RandLA-Net copied to clipboard

Compile nearest neighbors in utils folder in windows platform successfully,but the output From test.py in nearest_neighbors does not make sense

Open Asher-1 opened this issue 4 years ago • 6 comments

test code: batch_size = 16 num_points = 81920 K = 16 pc = np.random.rand(batch_size, num_points, 3).astype(np.float32) start = time.time() neigh_idx = nearest_neighbors.knn_batch(pc, pc, K, omp=True) print(neigh_idx) print(time.time() - start)

output: [[[ 59850369269760 69647189689088 274817777422134 ... 56272661532383 262607185448689 318420285453364] [328663782391810 140750373277917 34153580003909 ... 311569812619930 40875203811473 302211078855452] [ 47386374176772 231047765694742 39943195853852 ... 198762496550412 195902048345583 141721035906807] ... [ 15990163324922 92062624050510 53622666738905 ... 245843928078198 319996538404611 152741922011302] [209027468443644 308692184498657 76205604756955 ... 177004192245250 308120953827579 20323785311056] [ 57488137338878 338052580948640 320615013747694 ... 97431333174215 159742718651931 337429810671705]]

[[199050259333120 149645250529752 202851305450496 ... 211802017241215 45616847700539 69569880292819] [269917219717122 335544320061626 324274325849474 ... 195330817693302 164230959532848 132478266306588] [114344914321412 157122788639236 127530463926362 ... 277437707518344 304079389641883 302949813268785] ... [263015207354362 16810502019053 43241730812393 ... 129231270975903 334870010184279 245384366566049] [119361436205052 8774618202250 287067024153694 ... 91499983310969 345216586366319 152235115843762] [149005300482046 309997854535759 320636488577726 ... 343507189380908 83902186207902 133169755985587]]

[[264514150858752 283742719470396 21685289937883 ... 287930312630920 127582003572517 79383880607819] [ 96804267884546 31310311652801 206871394801928 ... 221469988667406 244070106534167 265325899714124] [ 7391638716420 296498772388095 71347996741495 ... 120628451544077 331124798658202 43602508002139] ... [261636522852346 203813378129659 258892038695631 ... 234204566709116 236566798720720 117441585779360] [115826678120444 73104638363468 213528594117837 ... 228921756895088 346105644598087 334380383915698] [334535002767358 184550449801324 73834782807571 ... 200291504941340 169376330320560 301639848205067]]

...

[[ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] ... [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0]]

[[ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] ... [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0]]

[[ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] ... [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0] [ 0 0 0 ... 0 0 0]]] 3.8556933403015137

Asher-1 avatar May 21 '20 10:05 Asher-1

Hi @Asher-1, many thanks for your interest in our work.

We haven't tested this code in windows, so can you please try this on the recommended configurations?

QingyongHu avatar May 27 '20 09:05 QingyongHu

I am also meeting the same problem in windows,the value of last dim of neigh_idx are all 0

xyj2220010 avatar May 28 '20 08:05 xyj2220010

The problem is that windows long is 32 bit int (not 64 as on unix). To get the correct results, replace all instances of “long” and “np.long” with “long long” and “np.longlong” respectively in knn_.cxx, knn_.h and knn.pyx.

The result will be correct, but the question remains why test.py processes 4 times longer on Windows than on Ubuntu on the same machine.

ghost avatar Jul 15 '20 10:07 ghost

The problem is that windows long is 32 bit int (not 64 as on unix). To get the correct results, replace all instances of “long” and “np.long” with “long long” and “np.longlong” respectively in knn_.cxx, knn_.h and knn.pyx.

The result will be correct, but the question remains why test.py processes 4 times longer on Windows than on Ubuntu on the same machine.

Thank u very much! It confused me so much when I tested it on windows. It seems not a good idea to run this module on windows.

goutougu avatar Mar 29 '21 12:03 goutougu

@Asher-1 Can you tell me how to compile the nearest neighbors in utils folder in windows platform?

hduonggithub avatar Apr 30 '21 15:04 hduonggithub

@hduonggithub Can you tell me how to compile the nearest neighbors in utils folder in windows platform?

python setup.py build_ext --inplace

Zhaoguanhua avatar Sep 06 '21 08:09 Zhaoguanhua