I am attempting to model a protein using an AlphaFold2 (AlphaFold v2.1.0.) CoLab (https://colab.research.google.com/github/deepmind/alphafold/blob/main/notebooks/AlphaFold.ipynb#scrollTo=pc5-mbsX9PZC).
I have done this successfully on 9/2/2022. However I have repeatedly had issues since 9/7/2022 doing the modelling with a different peptide sequence.
I get the following warning when I run the search against the genetic databases:
/opt/conda/lib/python3.7/site-packages/haiku/_src/data_structures.py:37: FutureWarning: jax.tree_structure is deprecated, and will be removed in a future release. Use jax.tree_util.tree_structure instead.
PyTreeDef = type(jax.tree_structure(None))
I then get several other future warnings when I run AlphaFold2 about other jax.tree_ deprecations.
The problem with AlphaFold running seems to be related to this:
AttributeError: module 'jax' has no attribute 'tree_multimap'
I have tried substituting jax.tree_util.tree_structure with no success.
I see another question on stackoverflow that is similar (AttributeError: module 'jaxlib.xla_extension' has no attribute 'PmapFunction'), however I do not know how best to implement the solution in the CoLab environment.
How should I fix this issue so that AlphaFold2 will run properly?
Traceback shown below:
44 processed_feature_dict = model_runner.process_features(np_example, random_seed=0)
---> 45 prediction = model_runner.predict(processed_feature_dict, random_seed=random.randrange(sys.maxsize))
/opt/conda/lib/python3.7/site-packages/haiku/_src/stateful.py in difference(before, after)
310 params_before, params_after = box_and_fill_missing(before.params,
311 after.params)
--> 312 params_after = jax.tree_multimap(functools.partial(if_changed, is_new_param),
313 params_before, params_after)
jax.tree_multimap was deprecated in JAX version 0.3.5, and removed in JAX version 0.3.16.
You can either change the source to use jax.tree_map as a drop-in replacement for jax.tree_multimap, or install an older version of JAX, e.g.:
!pip install "jax<=0.3.16" "jaxlib<=0.3.16"
And then be sure to restart your runtime to pick up the new versiom.
When I run the code below it shows me the error.
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
I have been searching solution on the online. The problem is the code below working in old version of torch (0.4.1). I want to know whether it is possible to modify or replace this code for working in the new version of pytorch.
from torch.utils.ffi import _wrap_function
from ._nms import lib as _lib, ffi as _ffi
__all__ = []
def _import_symbols(locals):
for symbol in dir(_lib):
fn = getattr(_lib, symbol)
if callable(fn):
locals[symbol] = _wrap_function(fn, _ffi)
else:
locals[symbol] = fn
__all__.append(symbol)
_import_symbols(locals())
I am facing the same problem have just seen some useful information in:
https://pytorch.org/tutorials/advanced/cpp_extension.html
https://pytorch.org/docs/stable/cpp_extension.html
To avoid downgrade the version of PyTorch, you should consider to use the following libraries while finding more details in the above links:
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CppExtension
I am a Python newbie currently looking into Crash Course Ai #5 How to Make an AI read your handwriting (LAB).
Running Step 1.2 gives me *NameError: name 'extract_training_samples' is not defined.
Tried so far: 1) updated pip version to 20.0.2 and installed emnist python package
2) tried an additional line of code: from emnist import extract_training_samples but got a ModuleNotFound error.
Feedback appreciated!
OK, very simple solution!
You just forgot the "s".
I find myself running into that problem all the time when coding. Whenever I run into a Name Error, the first thing I do is check my spelling!
your code:
x, y = extract_training_sample('letters')
the code on the website:
extract_training_samples('letters')
Cheers,
Using opencv for first time for object detection in an image by referring code from https://pysource.com/2019/06/27/yolo-object-detection-using-opencv-with-python/
(P.S- I am new to DeepLearning)
Problem:
When I run below line of code:
net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
I get below mentioned error:
----> 5 net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
AttributeError: module 'cv2.dnn' has no attribute 'readNet'
To Solve this:
1) After some google on this I tried to update my opencv by using conda update opencv-python and also tried installing again using conda install -c conda-forge opencv but it remains at 3.3.1 version even after several attempts.
2) Then I learned that I need to uninstall all previous versions of opencv but I couldn't find any folder for opencv to delete just manually and conda uninstall opencv is running from hours now with some status Finding shortest conflict path for python xxxxxx and still running
3) I am thinking of manually deleting all opencv files and also able to locate opencv files but I am not sure if I should delete all of these files to reinstall opencv or not.
4) I need advice if is it safe to delete below mentioned files or not and if I delete them and reinstall opencv then should it work or not. Please Help!!
opencv files:
'C:\\Anaconda\\Library\\bin\\opencv_annotation.exe',
'C:\\Anaconda\\Library\\bin\\opencv_annotation.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_annotation.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_aruco331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_aruco331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_aruco331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_bgsegm331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_bgsegm331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_bgsegm331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_calib3d331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_calib3d331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_calib3d331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_ccalib331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_ccalib331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_ccalib331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_core331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_core331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_core331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_createsamples.exe',
'C:\\Anaconda\\Library\\bin\\opencv_createsamples.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_createsamples.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_datasets331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_datasets331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_datasets331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_dnn331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_dnn331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_dnn331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_dpm331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_dpm331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_dpm331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_face331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_face331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_face331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_features2d331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_features2d331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_features2d331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_ffmpeg331_64.dll',
'C:\\Anaconda\\Library\\bin\\opencv_flann331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_flann331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_flann331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_fuzzy331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_fuzzy331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_fuzzy331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_highgui331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_highgui331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_highgui331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_imgcodecs331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_imgcodecs331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_imgcodecs331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_imgproc331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_imgproc331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_imgproc331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_img_hash331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_img_hash331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_img_hash331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_interactive-calibration.exe',
'C:\\Anaconda\\Library\\bin\\opencv_interactive-calibration.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_interactive-calibration.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_line_descriptor331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_line_descriptor331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_line_descriptor331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_ml331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_ml331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_ml331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_objdetect331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_objdetect331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_objdetect331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_optflow331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_optflow331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_optflow331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_phase_unwrapping331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_phase_unwrapping331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_phase_unwrapping331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_photo331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_photo331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_photo331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_plot331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_plot331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_plot331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_reg331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_reg331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_reg331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_rgbd331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_rgbd331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_rgbd331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_saliency331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_saliency331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_saliency331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_shape331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_shape331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_shape331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_stereo331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_stereo331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_stereo331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_stitching331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_stitching331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_stitching331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_structured_light331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_structured_light331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_structured_light331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_superres331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_superres331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_superres331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_surface_matching331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_surface_matching331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_surface_matching331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_text331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_text331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_text331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_tracking331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_tracking331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_tracking331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_traincascade.exe',
'C:\\Anaconda\\Library\\bin\\opencv_traincascade.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_traincascade.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_version.exe',
'C:\\Anaconda\\Library\\bin\\opencv_version.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_version.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_video331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_video331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_video331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_videoio331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_videoio331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_videoio331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_videostab331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_videostab331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_videostab331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_visualisation.exe',
'C:\\Anaconda\\Library\\bin\\opencv_visualisation.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_visualisation.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_waldboost_detector.exe',
'C:\\Anaconda\\Library\\bin\\opencv_waldboost_detector.exe.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_waldboost_detector.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_xfeatures2d331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_xfeatures2d331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_xfeatures2d331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_ximgproc331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_ximgproc331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_ximgproc331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_xobjdetect331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_xobjdetect331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_xobjdetect331.pdb',
'C:\\Anaconda\\Library\\bin\\opencv_xphoto331.dll',
'C:\\Anaconda\\Library\\bin\\opencv_xphoto331.dll.manifest',
'C:\\Anaconda\\Library\\bin\\opencv_xphoto331.pdb']
I wonder if you use Windows if so I strongly suggest you move to Ubuntu, it's free and you can install it on Virtual Machine. Here is step-by-step tutorial how to install OpenCV from sources: https://www.learnopencv.com/install-opencv3-on-ubuntu/
It works fine and I never had any issue during this installation.
I am on ubuntu 14.04.02, i have python, cython and numpy installed and updated.
i pulled the latest sources of open cv from http://github.com/itseez/opencv, compiled according to the documentation...
when trying to run the python source i pulled from https://github.com/shantnu/FaceDetect/
it's giving me the following error :
modprobe: FATAL: Module nvidia not found.
Traceback (most recent call last):
File "face_detect.py", line 21, in
flags = cv2.cv.CV_HAAR_SCALE_IMAGE
AttributeError: 'module' object has no attribute 'cv'
to make sure i have the python bindings i typed the following in the terminal:
python
import cv2
cv2.__version__
it returned the following
'3.0.0-dev'
what could be wrong with it?
the cv2.cv submodule got removed in opencv3.0, also some constants were changed.
please use cv2.CASCADE_SCALE_IMAGE instead
(do a help(cv2) to see the updated constants)
Apologies for the bump, but the above did not work for me, and I found an alternate "solution", but it may have unwanted side effects, given I know SFA about openCV.
The simple solution is just set it to 0.
# Detect faces in the image
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
# flags = cv2.cv.CV_HAAR_SCALE_IMAGE
flags = 0
)
As you can see... i just set it to 0 and could move on with my life.
I tried all number of combinations, and I couldn't get the CASCADE_SCALE_IMAGE working.
This openCV doco explaination gives me nadda, zip, nothing but confusion.
flags – Parameter with the same meaning for an old cascade as in the function cvHaarDetectObjects. It is not used for a new cascade.
That cleared it up...
Anyway, the example on openCV hard codes it to 0.