artificio
artificio copied to clipboard
[Help!!]error of spawning new processes while running image_retrieval.py
I am getting the following error of spawning the process while running "python image_retrieval.py"
Brief error message: RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if name == 'main': freeze_support()
Can anyone plz help me saying why I am getting this error and how to get rid of this error?
Same error here. maybe the file image_retrieval.py be wrapped in a main() function and then end with:
if name == "main": main()
edit:
yep, did just that and it works, as in:
import os import numpy as np import tensorflow as tf from sklearn.neighbors import NearestNeighbors from src.CV_IO_utils import read_imgs_dir from src.CV_transform_utils import apply_transformer from src.CV_transform_utils import resize_img, normalize_img from src.CV_plot_utils import plot_query_retrieval, plot_tsne, plot_reconstructions from src.autoencoder import AutoEncoder
if name == 'main': # Run mode: (autoencoder -> simpleAE, convAE) or (transfer learning -> vgg19) modelName = "vgg19" # try: "simpleAE", "convAE", "vgg19" trainModel = True parallel = True # use multicore processing ... ..._
Another problem generated after I added below to the code. if name== "main": The problem is with the "Class ImageTransformer (object)"