mikeyEcology / MLWIC

Machine Learning for Wildlife Image Classification
70 stars 16 forks source link

Python location #30

Open alicehua11 opened 5 years ago

alicehua11 commented 5 years ago

Hi, I tried running the classify function for the example provided and still couldn't run it after reading through the Stackoverflow and reinstalling numpy. I have:

setup(python_loc = "C:/Users/alice/Anaconda3/", conda_loc = "auto" ) That ran fine with exception of "Error: Error 1 occurred installing packages into conda environment r-reticulate" which is fine under the README

Then in my classify(), I have: python_loc = "C:/Users/alice/Anaconda3/bin/" It says the result is stored in the path listed but there is no model_predictions.txt.

Then I tried: python_loc = "C:/Users/alice/Anaconda3/" This gives me a error :

"Traceback (most recent call last): File "C:\Users\alice\ANACON~2\lib\site-packages\numpy\core__init__.py", line 16, in from . import multiarray ImportError: DLL load failed: The specified module could not be found."

I then traced to the init.py and found line 16, not sure why the module is not found because multiarray is in there along with this init file. I reinstalled numpy, still no luck. Any thought?

mikeyEcology commented 5 years ago

Hi @alicehua11 can you please post the full command that you specified for classify and the full output that you got?

alicehua11 commented 5 years ago

Hi Mike,

I have resolved this issue on my own. Apparently the package reticulate needs to be installed. The Error 1 occurred installing packages into conda environment r-reticulate needs to be addressed. It is not fine according to the README. From what I read, reticulate allows the connection between Python and R. Here is what I did. I found this path from running the py_discover_config() in the console.

#install.packages("reticulate")
library(reticulate)
reticulate::use_python("C:\\Users\\alice\\AppData\\Local\\Programs\\Python\\Python36\\")

Then I had to delete ANACON~2, a hidden directory that R keeps referring to when it looks for numpy. This is how I know.

py_discover_config()
rm ANACON~2 rf

There is a tensorflow version problem as well, I had to downgrade tensorflow v2 to v1.4 because it did not have the attribute slice_input_producer.

classify(path_prefix = "D:/Cal_Spring_2019/URAP/photo_classification/images", # this is the absolute path to the images. 
         data_info = "D:/Cal_Spring_2019/URAP/photo_classification/image_labels.csv", 
         model_dir = "D:/Cal_Spring_2019/URAP/photo_classification", # assuming this is where you stored the L1 folder in Step 3 of the instructions: github.com/mikeyEcology/MLWIC/blob/master/README
         python_loc = "C:\\Users\\alice\\AppData\\Local\\Programs\\Python\\Python36\\", # the location of Python on your computer. 
         save_predictions = "model_predictions.txt" # this is the default and you should use it unless you have reason otherwise.
         )

Now my classify command looks like this and it has been working thus far.