una-dinosauria / Rayuela.jl

Code for my PhD thesis. Library of quantization-based methods for fast similarity search in high dimensions. Presented at ECCV 18.
MIT License
63 stars 4 forks source link

Problem in running OPQ #33

Closed sepehr3pehr closed 5 years ago

sepehr3pehr commented 5 years ago

Hi, I am trying to turn the demos_train_query_base.jl but I get the following error seems there is a problem with calling update_centers! function.

WARNING: CuArrays.BLAS is deprecated, use CUBLAS instead.
  likely near /home/sepehr/mcq/demos_train_query_base.jl:172
┌ Warning: implicit `dims=2` argument now has to be passed explicitly to specify that distances between columns should be computed
│   caller = ip:0x0
└ @ Core :-1
┌ Warning: implicit `dims=2` argument now has to be passed explicitly to specify that distances between columns should be computed
│   caller = _kmeans!(::Array{Float32,2}, ::Nothing, ::Array{Float32,2}, ::Array{Int64,1}, ::Array{Float32,1}, ::Array{Int64,1}, ::Array{Float64,1}, ::Int64, ::Float64, ::Int64, ::Distances.SqEuclidean) at kmeans.jl:115
└ @ Clustering ~/.julia/packages/Clustering/pvAp6/src/kmeans.jl:115
ERROR: LoadError: MethodError: no method matching update_centers!(::Array{Float32,2}, ::Nothing, ::Array{Int64,1}, ::Array{Bool,1}, ::Array{Float32,2}, ::Array{Float32,1})
Closest candidates are:
  update_centers!(::AbstractArray{T<:Real,2}, ::Nothing, ::Array{Int64,1}, ::Array{Bool,1}, ::AbstractArray{T<:Real,2}, !Matched::Array{Float64,1}) where T<:Real at /home/sepehr/.julia/packages/Clustering/pvAp6/src/kmeans.jl:247
  update_centers!(::AbstractArray{T<:Real,2}, !Matched::AbstractArray{#s106,1} where #s106<:Real, ::Array{Int64,1}, ::Array{Bool,1}, ::AbstractArray{T<:Real,2}, !Matched::Array{Float64,1}) where T<:Real at /home/sepehr/.julia/packages/Clustering/pvAp6/src/kmeans.jl:295
  update_centers!(::Any, ::Any, ::Any, ::Any) at /home/sepehr/.julia/packages/Clustering/pvAp6/src/fuzzycmeans.jl:30
Stacktrace:
 [1] train_opq(::Array{Float32,2}, ::Int64, ::Int64, ::Int64, ::String, ::Bool) at /home/sepehr/.julia/dev/Rayuela/src/OPQ.jl:121
 [2] experiment_opq(::Array{Float32,2}, ::Array{Float32,2}, ::Array{Float32,2}, ::Array{UInt32,1}, ::Int64, ::Int64, ::String, ::Int64, ::Int64, ::Bool) at /home/sepehr/.julia/dev/Rayuela/src/OPQ.jl:155
 [3] run_demos(::String, ::Int64, ::Int64, ::Int64, ::Int64) at /home/sepehr/mcq/demos_train_query_base.jl:37
 [4] top-level scope at /home/sepehr/mcq/demos_train_query_base.jl:173 [inlined]
 [5] top-level scope at ./none:0
 [6] include at ./boot.jl:326 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1038
 [8] include(::Module, ::String) at ./sysimg.jl:29
 [9] exec_options(::Base.JLOptions) at ./client.jl:267
 [10] _start() at ./client.jl:436
in expression starting at /home/sepehr/mcq/demos_train_query_base.jl:172
sepehr3pehr commented 5 years ago

I changed the cweights type to zeros(Float64, h) and it solved the issue.

una-dinosauria commented 5 years ago

Thanks for figuring this out. It seems like the internals of Clustering.jl have changed.

You know what they say -- "a little bit of copying is better than a little bit of dependency". Perhaps I should copy the methods I use from Clustering.jl and that will make sure they never break.

I'll submit a patch and close this soon.