Coder Social home page Coder Social logo

Comments (8)

fabiocarrara avatar fabiocarrara commented on August 18, 2024

Hi @Jezzffihuter . I think you need to install pytorch, follow this: https://pytorch.org/get-started/locally/

This should solve the error on git bash.
The Pycharm error is a different problem; you need to configure input arguments when you run scripts from Pycharm, but I suggest proceeding with git bash.

from visual-sentiment-analysis.

Jezzffihuter avatar Jezzffihuter commented on August 18, 2024

Many thanks for your reply!
I have installed both torch and tqdm on Git Bash (upon its complaints). I also added these two packages to PATH (environment variables).
When I am trying to run python predict.py images_list.txt --model vgg19_finetuned_all --batch_size 64 > predictions.csv, it further returns predict.py: error: unrecognized arguments: --batch_size 64.
image
image
I Googled it, but it seems that --batch_size 64 is a code unique to the model.
It would be great if you could explain a little bit about this error, appreciate!

from visual-sentiment-analysis.

fabiocarrara avatar fabiocarrara commented on August 18, 2024

It should be --batch-size instead of --batch_size. My bad, I'm fixing the README.

from visual-sentiment-analysis.

Jezzffihuter avatar Jezzffihuter commented on August 18, 2024

@fabiocarrara Thanks for your immediate reply.

With the fixed code, I proceeded, but with other problems.

  • Firstly, the ERROR AssertionError: Torch not compiled with CUDA enabled

image
The above result is from the either of two combinations as below.
image
image
In both the two cases above, I have installed the PyTorch with the following set-up and added the address to the environmental variable in PATH.

I understand that this may because that I have not successfully downloaded CUDA.

There is always some ERROR as I am doing on Win 10 Enterprise and GeForce 1660 Ti, and I don't think this is supported by CUDA officially (https://developer.nvidia.com/zh-cn/cuda-gpus).

image

  • Secondly, if I change the OS to windows and re-download Torch (https://pytorch.org/get-started/locally/) with the following settings,
    image
    the Linux-based version will be replaced. The AssertionError is not reported, but there are two more.
    image
    Still, when typing "python predict.py images_list.txt --model vgg19_finetuned_all --batch-size 64 > predictions.csv", it returns with ERROR AttributeError: Can't pickle local object 'main..'
    image
    May I check whether the downloaded combination (with Windows) is correct on Git Bash? If it is correct, should I try to change the code as here matterport/Mask_RCNN#93? Actually, I am not quite familiar with your code and thus feel it hard to experiment.

Another ERROR is EOFError: Ran out of input
I see that this may because I have created an empty images_list.text, however, may I consult what would be the requirement (e.g,., local or online document) and format (e.g., jpg file, some particular naming rules) https://stackoverflow.com/questions/24791987/why-do-i-get-pickle-eoferror-ran-out-of-input-reading-an-empty-file

Therefore, to which direction should I try: 1) operate with CUDA and fix the AssertionError ; 2) operate with GPU and fix the AssertionError ; 3) following the second thread of solution (can this solve the AssertionError?), my preliminary guess may be to change the code and add some content in images_list.text.

Sorry for so lengthy a note as I have tried so many times.
My sincere thanks for your crucial guidance.

from visual-sentiment-analysis.

fabiocarrara avatar fabiocarrara commented on August 18, 2024

you can try running the script initially without CUDA; remove all the .to('cuda') instances in the predict.py script.

The image_list.txt file should be something like this:

path/to/image1.jpg
path/to/image2.png
...

from visual-sentiment-analysis.

Jezzffihuter avatar Jezzffihuter commented on August 18, 2024

@fabiocarrara Hi, thanks for your reply. Advice from you does benefit me.

  • As far as I see, there are only two .to('cuda') in predict.py script

image
Please correct me if my understanding is wrong.

  • I personally suspect that there may be a minor consistency between Git Bash and Pycharm.

While the predict.py in PyCharm expects an "image_list", the Git Bash expects an "images_list.txt" when I type in ~/OneDrive - HKUST Connect/Desktop/hkust mphil sosc/Video Analysis/Data/visual-sentiment-analysis-main.
image
image
Could this be a minor bug to fix? So should I name the image text as "images_list.txt" (I am using this for now) or "image_list.txt" when doing it on Git Bash?
image

I have included a sample jpg. and png. pictures in "images_list.txt", and ensure that these claimed locations truly exist.
image
image
image

  • However, it still returns with errors, namely AttributeError: Can't pickle local object 'main..', and EOFError: Ran out of input.

image
I have Googled, but I think this may concern the file type/settings specific to the program, so I am sincerely seeking help.

While your guidance does greatly accelerate my progress, I hope this will not take a lot of time for you.
Many thanks in advance. I guess we are pretty close if we get through the last few problems!

from visual-sentiment-analysis.

fabiocarrara avatar fabiocarrara commented on August 18, 2024

I think you are confusing the parameter name "image_list" that is used throughout the script (args.image_list) with its value (the string "images_list.txt"). There are no inconsistencies, as you can rename your list file "asd.txt" and call the python script like this:

python predict.py asd.txt etc...

Note that when you run the script in PyCharm, it is called without any argument by default. You need to edit/create a Run Configuration to set up the arguments, e.g. asd.txt --model vgg19_finetuned_all --batch-size 64.
Search on the web how to edit run configurations and add parameters for your PyCharm version.

from visual-sentiment-analysis.

Jezzffihuter avatar Jezzffihuter commented on August 18, 2024

Thanks for your guidance! I will try it now.

from visual-sentiment-analysis.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.