AdityaShaha/CBIR-Using-CDH

cant access the database via the input image entry

sankopay opened this issue ยท 14 comments

i can't simply access the added CDH json database and Corel image database viah the 'CBIR Using Color Difference Histogram - Retrieval.ipynb' code, i did exactly as you said, saved the database in the mongodb and the folder CDH with the necessary json files are stored there, and then i still get the error below, i dont know what else should i do? and also the images are all separated by _ in middle but you just entered 690 and accessed the image easily, did you rename all of them manually?
image
image

I have noticed i only could import json files, and no success was achieved with the bson files, but in your code it initially calls the collection consisting bson files so i changed it into collection = client.coral3.metadata and put the db = ['C:/Users/acer/Desktop/CDH/Corel'], and i still get errors is there something i'm missing here?? this is the result when i ran it, it gives me error of 'distances', and i gotta add, i didn't run the "CDH.py" file, could that be the proble, because it did the reshape on Corel image dataset?
image

i'm still so naive in python and all about coding, and im trying really hard to grasp these stuff and i read the tutorials but then they didn't help me at all with this issue, i'm sorry for the inconvenience, i know you must be really busy to be answering me, but i really need your code for my image processing project about the image retrieval via the color histograms, and mine was although about CBIR via 'fuzzy' color histograms using k-means clustering algorithm but i just couldn't implement it myself so i chnaged the subject into what you have already implemented here, but i still got these issues with running it... i'd be very very grateful if you could please take a look and help me with it...
btw some necessary information, i use python 3.7 (x64), pymongo-3.10.1, mongodb compass community, and some mentioned docker for some issues so it's docker 4.2.0 as well if these information helps,
i have also imported the database and collection of the dump files via studio 3t and robot 3t, and the files are already there, but i dont know what might be the problem here...
image

*** and i may add could you please consider my semi-intermediate level of python and maybe if you thought there;s a problem that might put me in some challenge, please be kind to explain a lil bit simpler, thanks a lot in advance ***

So there are a few things that I think you might have done wrong:

  1. ] You probably have not restored the mongodump correctly. After doing that correctly, the CDH Database should look something like the image attached below. I have added more instructions in the README.md to make it clearer.
  2. ] Yes, you have to rename the images, but you don't have to manually do it. You can do it using python. The code for which is now added as a part of the Jupyter Notebook. Just make sure that you put all the images in the 10k dataset in the folder named Corel10k in the same folder in which you are executing the notebook.
    I think these things should fix the issue at hand. In case there are any more errors please feel free to reply to this thread. For me I was able to solve the issues that you were facing on my system. Kudos !

PS : Make sure that you do a git pull origin master before re-executing the notebook.

Screen Shot 2020-06-28 at 7 00 22 AM

thanks for the reply please don't close the thread, just give me a couple days please because im a bit busy with exams and it takes me time to try the solution and give some feedback, but thanks anyway kind sir

but while we're at it, how did you add this collection cuz mongodb compass community only allows me to add json at a time or bson at a time, it's not like i can add both, and now i just reinstalled it and this is what i get
image

also see that if i want to restore your dump folder using studio 3t,
image
this was how i tried to restore the folder and this is what i get

image

i dont really know if im being naive here or not but i dont get what the real problem is here

There is an easy way to do this.

  1. Fire-up your terminal / command-prompt.
  2. cd to the folder where the dumps are stored. Like all the BSON/JSON Files.
  3. Run a simple command which the README.md has
cd dump/CDHCorel/
mongorestore --db db_name .

Explanation of the commands above

  • cd dump/CDHCorel/ will take you to the folder where the dumps are.
  • mongorestore --db db_name . : This command tells mongo to restore (basically add all the JSON/BSON files) to the database into the db_name which in yourcase is CDH and should be CDH and the . basically tells mongo the location of these JSON/BSON files.
    PS : Also make sure that you have your mongo-server running. You can do this by typing mongod in a separate command -prompt.
    Let me know if this works ๐Ÿ‘

the problem is that comand prompt doesn't know mongorestore at all, therefore i tried to manually add the database/collection

Can you please share the error here when you do mongorestore from the command-line ?

okay so let me go through this whole step with you once and for all to clarify it and not make any troubles for you anymore...

first i downloaded the image database and named it "Corel" with 10k images, put it into a folder and all those bson/json files as well and the pre-written code of yours, and then i have to run exactly this "cd dump/CDHCorel/ (which is already done with the command so i have to run the next command of db-name right?) mongorestore --db db_name . (and for this i dont have to replace db_name with Corel or anything right?) and then this is where it says the most common warning of (( 'mongorestore' is not recognized as an internal or external command, operable program or batch file.)) and i guess this is where my main problem lies on, i have run the robo 3t and have connected to my local server and have stored a CDH database with only the 2 json collection, so is it wrong anything i do in these things already?
is there a way i could twitch all these dump files or json/bson files and use the images directly or an easy way to all this????
sorry for the inconvenience and all the trouble already...

C:\Program Files\MongoDB\Server\4.2\bin>mongod
also i did this and the local server takes too long to repond, it's like this >

image

you told me to keep it running in the background while i do it, and then i shouldnt change the db = [] in the code right?
also i manually made the folder C:\data\db because the command of mongod wanted it, is that right? because the stackoverflow forum said so...

image

ok so update on the whole issue, i just copy pasted everything into desktop and boom! suddenly everything worked out fine but now i get this error please help me fix this too, why does it say it's out of range???

I think you have not pulled the latest GitHub version of the code. Did you do a git pull origin master before executing the code ?

im sorry but i dont know how to do that, i mean i just downloaded this git 2.27 and there's this command prompt in it, so i should just put "git pull origin master" that's all? or should i cd to the repository folder and then do it? but it wants a .git file but the repository only got a .gitgnore file, is that it???

my problem was ridiculous!!!! the bin folder in PATH was wrong because i manually edited it for some other project into Cmake/bin and i just had to restore it back to mongodb/bin and itโ€™s now solved im so sorry for all the trouble tho, but this solution was okay when i did run the mongod.exe from prompt after i solved the bin issue, thanks a lot for taking your time to solve my problem even though you mustโ€™ve got a crazy busy schedule, never forget your kindness sir! ๐Ÿ™๐Ÿป๐Ÿ™๐Ÿป๐Ÿ™๐Ÿป