Problems when I run ML-GCN - python

'''
PS D:\ML-GCN\ML-GCN-master> python demo_voc2007_gcn.py data/voc --image-size 448 --batch-size 1 -e --resume checkpoint/voc/voc_checkpoint.pth.tar
[dataset] read data/voc\data\data\data\voc\data\voc\files\VOC2007\classification_trainval.csv
Traceback (most recent call last):
File "D:\ML-GCN\ML-GCN-master\demo_voc2007_gcn.py", line 75, in <module>
main_voc2007()
File "D:\ML-GCN\ML-GCN-master\demo_voc2007_gcn.py", line 44, in main_voc2007
train_dataset = Voc2007Classification(args.data, 'trainval', inp_name='data/voc/voc_glove_word2vec.pkl')
train_dataset = Voc2007Classification(args.data, 'trainval', inp_name='data/voc/voc_glove_word2vec.pkl')
File "D:\ML-GCN\ML-GCN-master\voc.py", line 242, in __init__
self.images = read_object_labels_csv(file_csv)
File "D:\ML-GCN\ML-GCN-master\voc.py", line 95, in read_object_labels_csv
name = row[0]
IndexError: list index out of range
'''
The problem encountered when running ML-GCN, why does the problem of list index out of range appear, and how can I solve it

Related

Code runs fine in normal mode but throws exception in debug mode?

My code runs fine in normal mode but when i try to run it in debug mode it throws exception, I am trying to create a TF-IDF matrix of genre column in spotify_df. Why is this happening.
P.S - genre column of spotify_df contains 1-D list of strings and none of them is empty.
Code:
tracks_df = pd.read_csv('tracks_with_genres_v3.csv')
def create_tf_idf(spotify_df):
tfidf = TfidfVectorizer()
tfidf_matrix = tfidf.fit_transform(spotify_df['genres'].apply(lambda x: " ".join(x)))
genre_df = pd.DataFrame(tfidf_matrix.toarray())
genre_df.columns = ['genre' + "|" + i for i in tfidf.get_feature_names_out()]
genre_df.reset_index(drop=True, inplace=True)
return genre_df
def create_feature_set(spotify_df):
genre_tf_idf = create_tf_idf(spotify_df)
complete_feature_set = create_feature_set(tracks_df)
Exception:
Traceback (most recent call last):
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-packages\numpy\core\getlimits.py", line 516, in __init__
self.dtype = numeric.dtype(int_type)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2022.1.1\plugins\python\helpers\pydev\pydevd.py", line 1491, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2022.1.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 220, in <module>
begin("Heartless", "Weeknd")
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 179, in begin
complete_feature_set = create_feature_set(tracks_df)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 115, in create_feature_set
genre_tf_idf = create_tf_idf(spotify_df)
File "D:/PyCharm/Music_Recommendation_v2/main.py", line 95, in create_tf_idf
tfidf_matrix = tfidf.fit_transform(spotify_df['genres'].apply(lambda x: " ".join(x)))
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 2068, in fit_transform
X = super().fit_transform(raw_documents)
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 1328, in fit_transform
vocabulary, X = self._count_vocab(raw_documents, self.fixed_vocabulary_)
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-
packages\sklearn\feature_extraction\text.py", line 1222, in _count_vocab
if indptr[-1] > np.iinfo(np.int32).max: # = 2**31 - 1
File "D:\PyCharm\Music_Recommendation_v2\venv\lib\site-packages\numpy\core\getlimits.py",
line 518, in __init__
self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable

error on search image in python image_match library

I'm using python image_match library. I need to use search_image method of this library. but when I se this method I got the below error:
Traceback (most recent call last):
File "/var/www/html/Panel/test2.py", line 16, in <module>
ses.search_image('https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg/687px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg')
File "/usr/local/lib/python3.10/site-packages/image_match/signature_database_base.py", line 268, in search_image
transformed_record = make_record(img, self.gis, self.k, self.N)
File "/usr/local/lib/python3.10/site-packages/image_match/signature_database_base.py", line 356, in make_record
signature = gis.generate_signature(path)
File "/usr/local/lib/python3.10/site-packages/image_match/goldberg.py", line 161, in generate_signature
im_array = self.preprocess_image(path_or_image, handle_mpo=self.handle_mpo, bytestream=bytestream)
File "/usr/local/lib/python3.10/site-packages/image_match/goldberg.py", line 257, in preprocess_image
return rgb2gray(image_or_path)
File "/usr/local/lib/python3.10/site-packages/skimage/_shared/utils.py", line 394, in fixed_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/skimage/color/colorconv.py", line 875, in rgb2gray
rgb = _prepare_colorarray(rgb)
File "/usr/local/lib/python3.10/site-packages/skimage/color/colorconv.py", line 140, in _prepare_colorarray
raise ValueError(msg)
ValueError: the input array must have size 3 along `channel_axis`, got (1024, 687)
Can you please help me?

IndexError: list index out of range right after printing len(list) > 0

I literally have these two lines of code in sequence:
print(len(counter.ondas))
onda = counter.ondas[-1]
I got 13 printed for the first line and it crashed giving me tracebook to the onda = counter.ondas[-1] line saying IndexError: list index out of range right after printing len(list).
It works thousands of times before crashing. I have no clue on how to approach this problem.
Output for print(counter.ondas):
[Onda([<workers.mov.Mov object at 0x244EA050>], [Candle(4, 'GBP_JPY', Timestamp('2017-06-12 16:59:00'), 138.884, 138.897, 138.674, 138.76, 10957.0, True)]), Onda([<workers.mov.Mov object at 0x245073D0>], [Candle(4, 'GBP_JPY', Timestamp('2017-06-12 16:59:00'), 138.884, 138.897, 138.674, 138.76, 10957.0, True)...]
Output for print(type(counter.ondas)):
<class 'list'>
Output for print(isinstance(counter.ondas, list)):
True
Full Error Traceback
Traceback (most recent call last):
File "C:\Users\joaoa\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\joaoa\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\pool.py", line 44, in mapstar
return list(map(*args))
File "C:\Users\joaoa\PycharmProjects\aquitania\general_manager.py", line 88, in load_observer_manager
observer_manager.update_load_run_data()
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\management\observer_manager.py", line 78, in update_load_run_data
self.load_run_data()
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\management\observer_manager.py", line 91, in load_run_data
self.feeder.exec_df(df[self.start_date:])
File "C:\Users\joaoa\PycharmProjects\aquitania\data_source\feeder.py", line 429, in exec_df
self.feed(candle)
File "C:\Users\joaoa\PycharmProjects\aquitania\data_source\feeder.py", line 98, in feed
self.make_candle(ts, candle, criteria_table)
File "C:\Users\joaoa\PycharmProjects\aquitania\data_source\feeder.py", line 126, in make_candle
self.set_values(ts, candle)
File "C:\Users\joaoa\PycharmProjects\aquitania\data_source\feeder.py", line 310, in set_values
ts_obs.feed_complete(self._candles[ts])
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\management\observer_loader.py", line 100, in feed_complete
observer.update_last_candle(candle, store_candle)
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\abstract\observer_abc.py", line 93, in update_last_candle
self.set_observe(self.update_method(candle))
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\ondas\ondas_inside.py", line 393, in update_method
self.update_routine(counter_id=2, candle=candle)
File "C:\Users\joaoa\PycharmProjects\aquitania\observer\ondas\ondas_inside.py", line 412, in update_routine
onda = list(counter.ondas)[-1]
IndexError: list index out of range
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:/Users/joaoa/PycharmProjects/aquitania/general_manager.py", line 145, in <module>
gm.run()
File "C:/Users/joaoa/PycharmProjects/aquitania/general_manager.py", line 113, in run
list_of_observer_managers = self.load_all_observer_managers()
File "C:/Users/joaoa/PycharmProjects/aquitania/general_manager.py", line 60, in load_all_observer_managers
observer = currency_pool.map(self.load_observer_manager, list_of_currencies)
File "C:\Users\joaoa\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\pool.py", line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "C:\Users\joaoa\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\pool.py", line 644, in get
raise self._value
IndexError: list index out of range
I was able to idenfity the issue. The error was being thrown in a separate process than the one that was being printed and for some reason the error ocurred only after the process that was printing the results was interrupted by another unrelated error.
Weird behavior, but now I am able to tackle the problem.
Debugging in a single process mode helped a lot.
Thank you for your help.

Scapy won't start

My Scapy v2.3.3 won't start. Fresh reinstalled Python 2.7, WinPcap10 and pyreadline. Sometimes it starts after at second try in the same console.
c:\Python27\Scripts>scapy
c:\Python27\Scripts>python c:\Python27\Scripts\scapy
INFO: Can't import matplotlib. Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
Traceback (most recent call last):
File "c:\Python27\Scripts\scapy", line 26, in <module>
interact()
File "C:\Python27\lib\site-packages\scapy\main.py", line 300, in interact
scapy_builtins = __import__("all",globals(),locals(),".").__dict__
File "C:\Python27\lib\site-packages\scapy\all.py", line 16, in <module>
from scapy.arch import *
File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 83, in <module>
from scapy.arch.windows import *
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 318, in <module>
IFACES.load_from_powershell()
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 270, in load_from_powershell
for i in get_windows_if_list():
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 206, in get_windows_if_list
for line in query)
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 205, in <genexpr>
(dict(zip(['name', 'win_index', 'description', 'guid', 'mac'], line))
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 53, in _exec_query_ps
l.append(line.split(':', 1)[1].strip())
IndexError: list index out of range
This bug was implemented in 6840d30 (v2.3.3) and fixed in a454ef4, it could be fixed by changing
l.append(line.split(':', 1)[1].strip())
to
sl = line.split(':', 1)
if len(sl) == 1:
l[-1] += sl[0].strip()
continue
else:
l.append(sl[1].strip())

Error while using mloginfo m-tools

I want to analyze log file of mongodb. I am referred to use m-tools. But I'm getting following error.
I've typed in terminal
mlonginfo /..logfilelocation../ --queries
Error:
QUERIES [============================== ] 74.1 % Traceback (most recent call last):
File "/usr/local/bin/mloginfo", line 9, in <module>
load_entry_point('mtools==1.1.8', 'console_scripts', 'mloginfo')()
File "/usr/local/lib/python2.7/dist-packages/mtools/mloginfo/mloginfo.py", line 82, in main
tool.run()
File "/usr/local/lib/python2.7/dist-packages/mtools/mloginfo/mloginfo.py", line 77, in run
section.run()
File "/usr/local/lib/python2.7/dist-packages/mtools/mloginfo/sections/query_section.py", line 51, in run
for i, le in enumerate(logfile):
File "/usr/local/lib/python2.7/dist-packages/mtools/util/logfile.py", line 208, in __iter__
le = self.next()
File "/usr/local/lib/python2.7/dist-packages/mtools/util/logfile.py", line 190, in next
ret = le.set_datetime_hint(self._datetime_format, self._datetime_nextpos, self.year_rollover)
File "/usr/local/lib/python2.7/dist-packages/mtools/util/logevent.py", line 246, in set_datetime_hint
if not self.split_tokens[self._datetime_nextpos-1][0].isdigit():
IndexError: list index out of range
Thanks in advance.

Categories

Resources