how to fix ModuleNotFoundError: No module named '__main__.unet_model' - python

I am trying to run ID Card Segmentation (MIDV-500) on my Ubuntu machine.
I need to run some files, and one of them is "train.py".
when i run "train.py" i get an error message on the Import section.
(the full repository - https://github.com/AdivarekarBhumit/ID-Card-Segmentation)
i try to import:
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
from keras.callbacks import TensorBoard, ModelCheckpoint
from .unet_model import get_model
the error on the Terminal:
/Downloads/ID-Card-Segmentation/model$ python train.py
Using TensorFlow backend.
Traceback (most recent call last):
File "train.py", line 5, in <module>
from .unet_model import get_model
ModuleNotFoundError: No module named '__main__.unet_model'; '__main__' is not a package
how to fix that?

Related

No module error : "ImportError: cannot import name util"

I am getting the following error when I run my code
Traceback (most recent call last):
File "ros_colour_node.py", line 26, in <module>
from detectron2.engine import DefaultPredictor
File "/home/nvidia/catkin_ws/src/ROS-label-node/detectron2/__init__.py", line 3, in <module>
from .utils.env import setup_environment
File "/home/nvidia/catkin_ws/src/ROS-label-node/detectron2/utils/env.py", line 3, in <module>
from importlib import util
ImportError: cannot import name util
I am using python2.7 to run my code on ROS melodic on jetson xavier NX with ubuntu 18.04.
I have installed the importlib library directly but it cant seem to find the util module.
I am trying to run instance segmentation using ROS on JEtson. I have tried to run the code from the following repo Segmentation

ModuleNotFoundError: No module named 'tensorflow.contrib' while making chatbot

So I'm following a tutorial and making a chatbot in python and I'm using the tflearn and tensorflow modules, and when I run my code I get the following error:
Traceback (most recent call last):
File "/home/user/Coding Projects/chatbot/main.py", line 6, in <module>
import tflearn
File "/home/user/.local/lib/python3.8/site-packages/tflearn/__init__.py", line 4, in <module>
from . import config
File "/home/user/.local/lib/python3.8/site-packages/tflearn/config.py", line 5, in <module>
from .variables import variable
File "/home/user/.local/lib/python3.8/site-packages/tflearn/variables.py", line 7, in <module>
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ModuleNotFoundError: No module named 'tensorflow.contrib'
I can't figure out how to fix it, and was wondering if someone could help me.
check your tensorflow version(you can to check it like that)
`
import tensorflow as tf
print(tf.__version__)
`
tensorflow contrib was removed from tensorflow 2.0 and its functionallty was moved to other modules.

Tensorflow 2.0: Cannot Import tf.keras.utils.conv_utils

I'm using Tensorflow v2.1.0 which is compiled from source. How can I import any function from conv_utils module? E.g. convert_data_format(), conv_output_length(), normalize_tuple(), etc.
I wanna create my own convolution/pooling layer. "Everything" almost looks different when I wanna migrate from import keras to from tensorflow import keras.
This is what I did
> python -c "from tensorflow.keras.utils import conv_utils"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'conv_utils' from 'tensorflow.keras.utils' ...
Thank you.
Try this:
from tensorflow.python.keras.utils import conv_utils
This is the new way to import conv_utils in Tensorflow 2.1.0:
import tensorflow.keras.utils as conv_utils

from data import DataSet

I'm trying to replicate some Python code on a Github website. I'm running Python3.6.8 in a conda environment.
import numpy as np
import os.path
from data import DataSet
I get the Error:
Traceback (most recent call last):
File "extract_features.py", line 16, in <module>
from data import DataSet
ImportError: cannot import name 'DataSet'
I am not sure which module is causing this error. python -c "import data" gives no error.

Import modules from sklearn I get ImportError: DLL load failed: The specified module could not be found

recently I have been trying to get into machine learning, AI, ect and the tutorial i was following told me to import linear_model from sklearn what i used to import that is as follows:
from sklearn import linear_models
if I run this code alone I get the error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from sklearn import linear_model
File "C:\Users\Leo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\linear_model\__init__.py", line 15, in <module>
from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
File "C:\Users\Leo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sklearn\linear_model\least_angle.py", line 23, in <module>
from ..utils import arrayfuncs, as_float_array, check_X_y, deprecated
ImportError: DLL load failed: The specified module could not be found.

Categories

Resources