dragonfly90 / mxnet_Realtime_Multi-Person_Pose_Estimation

This is a mxnet version of Realtime_Multi-Person_Pose_Estimation, origin code is here https://github.com/ZheC/Realtime_Multi-Person_Pose_Estimation
125 stars 38 forks source link

How to convert zip's function to work on python 3.6.5 ? #24

Closed ghost closed 6 years ago

ghost commented 6 years ago
 peaks = zip(np.nonzero(peaks_binary)[1], np.nonzero(peaks_binary)[0]) # note reverse
    peaks_with_score = [x + (map_ori[x[1],x[0]],) for x in peaks]

I debug and got peaks_with_score = [] len(peaks) throw a error, I fixed by len(list(peaks)). and for x in peaks not work with zip. I want to know "what x[1] and x[0] are" to convert for it work in python 3.6.5

Anyone tell me ? Thank.

ghost commented 6 years ago

I fixed by:

        `peaks_binary_1 = np.nonzero(peaks_binary)[1]`
        `peaks_binary_2 = np.nonzero(peaks_binary)[0]`
        `length1 = len(peaks_binary_1)`
       ` length2 = len(peaks_binary_2)`
        `if length1 > length2:`
            `len_peak = length2`
       ` else:`
            `len_peak = length1`
        `peaks_with_score = []`
        `for i in range(0, len_peak):`
            `peaks_with_score.append(`
               ` (peaks_binary_1[i], peaks_binary_2[i]) + (map_ori[peaks_binary_2[i], peaks_binary_1[i]],)`
       `     )`