Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting this #3

Open
Yasanthig opened this issue Aug 29, 2021 · 1 comment
Open

I am getting this #3

Yasanthig opened this issue Aug 29, 2021 · 1 comment

Comments

@Yasanthig
Copy link

ImportError Traceback (most recent call last)
in
1 import hashlib
----> 2 from scipy.misc import imread, imresize, imshow
3 import matplotlib.pyplot as plt
4 import matplotlib.gridspec as gridspec
5 get_ipython().run_line_magic('matplotlib', 'inline')

ImportError: cannot import name 'imread' from 'scipy.misc' (C:\Users\User\anaconda3\lib\site-packages\scipy\misc_init_.py)

@vinson2233
Copy link

vinson2233 commented Sep 16, 2021

I changed the code into this

import hashlib
from imageio import imread
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
%matplotlib inline
import time
from tqdm import tqdm
import numpy as np
from glob import glob

def file_hash(filepath):
    with open(filepath, 'rb') as f:
        return md5(f.read()).hexdigest()

file_list = glob("directory_of_the_images")

import hashlib, os
duplicates = []
hash_keys = dict()

for index, filename in  tqdm(enumerate(file_list)):  #listdir('.') = current directory
    if os.path.isfile(filename):
        with open(filename, 'rb') as f:
            filehash = hashlib.md5(f.read()).hexdigest()
        if filehash not in hash_keys: 
            hash_keys[filehash] = index
        else:
            duplicates.append((index,hash_keys[filehash]))

The main problem is just resize and imshow is not needed, and imread have been deprecated from scipy and moved to imageio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants