Computer Vision: Errors and solutions in the implementation of Bag of words algorithm

Errors and solutions in the implementation of Bag of words algorithm

The problem

IndexError: list index out of range

The list exceeds the limit, the picture is wrong, or the two lines are changed to 0 and 5

Insert picture description here

OSError: x.sift not found

sift path problem, if it is wrong, change it several times, if the path is not in Chinese, change it in English

sqlite3.OperationalError: table imlist already exists

Delete this, and then run the "2.py" file

Insert picture description here

Line 45 (H,inliers = homography.H_from_ransac(fp[:,ind],tp[:,ind2],model,match_theshold=4)) error

Code changed to

    try:
        H,inliers = homography.H_from_ransac(fp[:,ind],tp[:,ind2],model,match_theshold=4)
    except:
        inliers = []

ValueError: did not meet fit acceptance criteria

See one trick below to solve

TypeError:%d format: a number is required,not NoneType

See one trick below to solve

TypeError:%d format: a number is required,not str

See one trick below to solve

Solution (one trick to solve all)

Other questions can be added in the comment area
1. Choose one of the following ways to download the file:
①Find me directly
②Click here: Baidu Cloud, extraction code 2333 ③Click
here: CSDN download
https://download.csdn.net/download/ After qq_43605229/19431118
decompression, the folder

Insert picture description here


looks like this 2. Right-click the sift.exe file, click Properties

Insert picture description here


3. Copy this string of addresses

Insert picture description here

4. Use Notepad to open this sift.py file (not the one above, pay attention to the picture below)

Insert picture description here


5. Select the front part of the address, paste, and close the file after saving

Insert picture description here


Insert picture description here


6. Then run according to the order of 1, 2, and 3 in the file
datasets folder put the picture data for other data directly inside delete files and then copy it